Posted: Fri May 02, 2014 5:25 pm Post subject: Config 1WIRE PORT-PIN ?
Hello. My friend can`t read DS18B20 on PORTD.0 in ATmega16 (ressistor attached)
Program run on test board on PORTD.7 successfully but don`t work on target board.
PORTD.0 is a RXD for RS232 but nothing is received or send in programm.
In my projects I always config all ports on beginning and set as Input for 1WIRE and its work. Then Config 1WIRE as PIND.0 not PORTD.0
Today I read help file and 1WIRE is config as PORT not PIN.
If anyone have experience of that diffrences tell me :D
the official syntax is to use a port but pin is accepted too.
the problem is when you enable rs232 (using $baud, print etc) the tx and rx pins are enabled for rs232.
so when you do not need RX you need to disable it in the uart control register : UCSR0B.7=0 'register name depends on the chip
most chips have an alias named UCR so use : UCR.7=0 to deactivate TX : UCR.6=0 _________________ Mark
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum