Global Moderator
Dallas
Offline
Shannon Member
Karma: 129
Posts: 10379
|
 |
« Reply #15 on: February 03, 2012, 01:48:06 am » |
In that case, I misunderstood the purpose of the cheat-sheet. I assumed it was meant to document pin mappings for Arduino compatible cores.
|
|
|
|
|
Logged
|
|
|
|
|
Tokyo, Japan
Offline
Newbie
Karma: 0
Posts: 18
|
 |
« Reply #16 on: February 03, 2012, 02:57:08 am » |
You didn't misunderstand: The new version of the cheat sheet was meant to do exactly that: For example, physical pin 11 on the ATTiny2313/4313 is PD6 (when programming in low-level avr-gcc) and is assigned to Arduino pin number 8: This is written as PD6/D8 in the cheat sheet.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Offline
Shannon Member
Karma: 129
Posts: 10379
|
 |
« Reply #17 on: February 03, 2012, 03:08:42 am » |
In that case, PB3 needs to be excluded for the X5 family. As far as I know, no Arduino compatible cores make use of inverted PWM outputs.
|
|
|
|
|
Logged
|
|
|
|
|
Tokyo, Japan
Offline
Newbie
Karma: 0
Posts: 18
|
 |
« Reply #18 on: February 03, 2012, 06:37:34 am » |
You won't be able to use the inverted PWM for Arduino, but the sheet covers both Arduino pin numbers and normal port numbers (that's why it says D3/PB3). That said, there should be a note saying that PB3 is a "special" PWM pin.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 13
Arduino rocks
|
 |
« Reply #19 on: February 05, 2012, 04:43:47 pm » |
Hey Karl_B thanks for this cheat sheet, looks great. Wonder if you could also include attiny84 ?
|
|
|
|
|
Logged
|
|
|
|
|
Tokyo, Japan
Offline
Newbie
Karma: 0
Posts: 18
|
 |
« Reply #20 on: February 05, 2012, 07:34:25 pm » |
Thanks kermit, attiny84 and attiny87/167 are on our TODO list. 
|
|
|
|
|
Logged
|
|
|
|
|
|
|
Global Moderator
Dallas
Offline
Shannon Member
Karma: 129
Posts: 10379
|
 |
« Reply #22 on: February 06, 2012, 10:34:37 pm » |
Nice. Thank you.
I have a suggestion: use ", " (comma space) instead of "/" (slash) to separate the labels. It's a little difficult to locate a pin from its function (like MISO).
|
|
|
|
|
Logged
|
|
|
|
|
Tokyo, Japan
Offline
Newbie
Karma: 0
Posts: 18
|
 |
« Reply #23 on: February 06, 2012, 10:53:14 pm » |
Thanks for the suggestion, we'll try it out and see how it looks
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 124
Arduino rocks
|
 |
« Reply #24 on: March 06, 2012, 03:53:05 pm » |
Great post. do you guys know what is the analog input pin numbers on the 2313 been reading the datasheet and can not find it.
thanks
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Offline
Shannon Member
Karma: 129
Posts: 10379
|
 |
« Reply #25 on: March 06, 2012, 04:45:37 pm » |
For the analog comparator or the analog-to-digital converter?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 124
Arduino rocks
|
 |
« Reply #26 on: March 06, 2012, 04:55:07 pm » |
more like Analog input/ Sensor input
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 124
Arduino rocks
|
 |
« Reply #27 on: March 06, 2012, 05:26:50 pm » |
I guess the analog is the PB0/AIN0/D9 I have been trying to get the analog input to work with a sensor how is set this pin to be a alaog input see sketch ///////////////////
int sensPin=PB0; // analog input for 2313 int sensVal=0; // value
int ledPin = 1; // The pin number of the LED int ledPin7 = 7;
//////SETUP////////
void setup() { pinMode( ledPin, OUTPUT ); // Sets the led pin to an output mode pinMode( ledPin7, OUTPUT ); // pinMode( sensPin, INPUT ); // Serial.begin(57600); //set Serial Data flow / debug/ read }
///LOOP///////////
void loop() { digitalWrite(ledPin7, HIGH); sensVal = analogRead(sensPin); // READS sensor,
if( sensVal > 350 ) // object is close to sensor?? {
digitalWrite( ledPin, HIGH ); //Turn LED pin on } if( sensVal < 450 ) {
digitalWrite( ledPin, LOW); // } }
Moderator edit: [code] [/code] tags added.
|
|
|
|
« Last Edit: March 06, 2012, 05:40:45 pm by Coding Badly »
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Offline
Shannon Member
Karma: 129
Posts: 10379
|
 |
« Reply #28 on: March 06, 2012, 05:41:39 pm » |
more like Analog input/ Sensor input An analog-to-digital converter. The 2313 does not have one.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Offline
Shannon Member
Karma: 129
Posts: 10379
|
 |
« Reply #29 on: March 06, 2012, 05:44:01 pm » |
I guess the analog is the PB0/AIN0/D9 That is one of the two inputs to the analog comparator. sensVal = analogRead(sensPin); // READS sensor, If you are using this core... http://code.google.com/p/arduino-tiny/...zero is always returned.
|
|
|
|
|
Logged
|
|
|
|
|
|