sraiderk
Joined: 09 Feb 2005 Posts: 48
|
UART How do you change parity or data len within program |
Posted: Thu Apr 23, 2009 8:08 am |
|
|
I want to adjust the following HARDWARE UART setting when pic at energized. For example; pic internal eeprom has the following values. I want to read this values from internal eeprom then I want to adjust hardware uart setting according to these read values from eeprom. This process is only active when pic at energized. After that I don't need any uart setting when pic run. Is it possible?
Uart_speed (example:9600)
Uart_parity (Example:Odd)
Stop_bit_length (Example:1,5)
Data_bit-length (Example: 7 or 8)
Code: | main()
{
int x;
x=read_internal_eeprom(0);
switch(x)
{
case 0:
#use rs232(baud=9600,parity=E,xmit=PIN_C6,rcv=PIN_C7,bits=8)
break;
case 1
#use rs232(baud=9600,parity=O,xmit=PIN_C6,rcv=PIN_C7,bits=7
break;
case 2
#use rs232(baud=19200,parity=n,xmit=PIN_C6,rcv=PIN_C7,bits=9
break;
}
while(true)
{
...;
...;
}
} |
Is it possible? |
|