Originally Posted by elektroline
N2400 = 2400 Baud Inverted
T9600 = 9600 True
N9600 = 9600 Inverted
Originally Posted by elektroline
N2400 = 2400 Baud Inverted
T9600 = 9600 True
N9600 = 9600 Inverted
Hi ,
Mister_e;
interrupt ll be for usart.....
My code is godd running. but i want to send data from pc and when send will data from pc goto serin routine and write eprom
Joe S. ;
i m using 18f452
and 10 MHz quartz. and config is hs_pll ( 10 x 4 = 40 mHz )
so baud= 2400 x 4 = 9600 ( i hope)
So your PIC have a Hardware USART, use it and use it's interrupts.
Use HSERIN instead of SERIN as it use the PIC Usart.
Maybe the following may help.
http://www.picbasic.co.uk/forum/show...1&postcount=11
You just need to set you USART register for the Right baudrate
something like
ORCode:RCSTA = $90 ' Enable serial port & continuous receive TXSTA = $20 ' Enable transmit, BRGH = 0 SPBRG = 64 ' 9600 Baud @ 0.16%
Code:DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0 DEFINE HSER_SPBRG 64 ' 9600 Baud @ 0.16% DEFINE HSER_CLROERR 1 ' Clear overflow automatically
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hi, i write this codes but... i think interrupt is not working and data is not send from pc to pic eprom..
DEFINE HSER_RCSTA 90h
DEFINE HSER_SPBRG 64
DEFINE HSER_CLROERR 1
RCIF VAR PIR1.5
EOM con ""
bilgi var byte
b var byte
start:
if RCIF then ' incomming data?
HSERIN [bilgi]
if bilgi= "@" then
goto pctalk
else
goto start
endif
endif
....
....
... other codes
....
....
pctalk:
getserial:
HSERIN [bilgi]
write b, bilgi
if bilgi = EOM then
Goto start
endif
B = b + 1
goto getserial
Consider...
HSERIN [bilgi]
... at 9600 baud means you're sending 9600 bits in a second... for arguments sake, say it takes 10 bits for one byte (with start and stop bits), so it takes less than 1mS per byte to receive...
And now...
write b, bilgi
...takes 10mS to write to EEPROM...
So for every ONE byte you save to EEPROM, using your code/method at only 9600 baud will ensure you lose the following 10/12 bytes of incoming data. Can you now see it's not so straightforward to receive RS-232 and write it to EEPROM... as you have to make sure that when you write to your EEPROM you're still going to grab any incoming data that may be arriving at the same time.
Bookmarks