Yeah but... used as input i won't change anything... and it's not a A version, so no comparator thingy... even if... it's already disabled at POR...
Yeah but... used as input i won't change anything... and it's not a A version, so no comparator thingy... even if... it's already disabled at POR...
Last edited by mister_e; - 11th June 2007 at 23:21.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hello everybody
Thank you for your answers
I would like to know how to initialize the UART.
Here is how I have make but that does not work.
(19200bps,No parity,8 bits,and 1 stop bit)
TXSTA = $20 '//Transmission sur 8 bits, pas de parité, mode asynchrone
RCSTA = $90
SPBRG=25
Bonjour,
Depending how you want to use the USART, the initialization setup will be different. Let's say you want to read/write from the PIC USART register (RCREG/TXREG) yourself, your setup above is almost what you need but not not 100% exact. for a 9600 baud @4MHZ, the setup will be
But more than often we want to use the power of a PBP built-in command, hence HSERIN/HSEROUT. In that case the right setup will be.Code:RCSTA = $90 ' Enable serial port & continuous receive TXSTA = $24 ' Enable transmit, BRGH = 1 SPBRG = 25 ' 9600 Baud @ 4MHz, 0.16%
This also assume you're going to use the PIC dedicated I/Os (TX/RX)Code:DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1 DEFINE HSER_SPBRG 25 ' 9600 Baud @ 4MHz, 0.16% DEFINE HSER_CLROERR 1 ' Clear overflow automatically
I would suggest you to download and use my PicMultiCalc, yeah i know i sound like a broken record but... agreed it's an handy tool.
http://www.mister-e.org/pages/utilitiespag.html
Bonne chance!
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Merci Mister e
But I would like to know another thing if I pass by the UART to register the information which goes into the PIC, how I have to proceed.
This line of program is good:
CTS = 1
SERIN PORTC.7,N9600,["@"],char 'wait for char. @ from the PC and store second @ in char... this is just a wait line, no received data is used
getserial:
Serin PORTC.7,N9600,char 'receive at 9600bps and store in variable char
write i, char 'write each received character to the memory
if char = EOM then
CTS = 0
Goto start
endif
i = i + 1
goto getserial
I am going to try with your configuration of the UART
Good day
Regards
Thank you for your help,
That works
Bookmarks