|
|
View previous topic :: View next topic |
Author |
Message |
Got PIC
Joined: 21 Mar 2008 Posts: 10
|
How to change the Parity, odd or even, on the fly using |
Posted: Fri Mar 21, 2008 8:23 pm |
|
|
I'm looking to change the RS232 parameters such as parity, stop bits, on the FLY. I have some code that allows a user to change the RS232 paramters and the only way I can see to chage the respect settings, is to use the #use rs232.
The problem Im having to being able to change, in and out, of different settings.
This is what I have tried so far..
Any help would ge great!
Note: I also tried putting the #use outside each function...no workie..
Code: | void test_set_b()
{
#use delay(clock=10000000)
#use rs232(baud=115200,PARITY=E,BITS=8,STOP=1,xmit=PIN_C6, rcv=PIN_C7,ENABLE = PIN_A5,stream=COMM_PORT1,errors)
//#use rs232(baud=115200,PARITY=N, BITS=8,xmit=PIN_C6,rcv=PIN_C7,ENABLE = PIN_A5,stream=COMM_PORT1,errors)
#use rs232(baud=115200,PARITY=N, BITS=8,xmit=PIN_G1,rcv=PIN_G2,ENABLE = PIN_F7, stream=COMM_PORT2,errors)
fprintf(COMM_PORT2,"RTS HIGH (NOT ACTIVE)PARITY=O, BITS=8,STOP=1\n\r");
delay_ms(1);
// Set Baud Rate to the user selected Baud rate.
}
void test_set_a()
{
#use delay(clock=10000000)
#use rs232(baud=115200,PARITY=N,BITS=8,STOP=1,xmit=PIN_C6, rcv=PIN_C7,ENABLE = PIN_A5,stream=COMM_PORT1,errors)
#use rs232(baud=115200,PARITY=N, BITS=8,xmit=PIN_G1,rcv=PIN_G2,ENABLE = PIN_F7,stream=COMM_PORT2,errors)
fprintf(COMM_PORT2,"RTS LOW (ACIVE) baud=115200,PARITY=N, BITS=8\n\r");
//Force baud rate to 115200 baud
} |
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Got PIC
Joined: 21 Mar 2008 Posts: 10
|
|
Posted: Fri Mar 21, 2008 9:09 pm |
|
|
Maybe I should have mentioned..
#use rs232(baud=115200,PARITY=N, BITS=8,xmit=PIN_C6, rcv=PIN_C7,ENABLE = PIN_A5,stream=COMM_PORT1,errors)
//#use rs232(baud=115200,PARITY=O, BITS=8,STOP=2, xmit=PIN_C6, rcv=PIN_C7,ENABLE = PIN_A5,stream=COMM_PORT1,errors)
#use rs232(baud=115200,PARITY=N, BITS=8,xmit=PIN_G1,rcv=PIN_G2,ENABLE = PIN_F7, stream=COMM_PORT2,errors)
I'm using both uarts on this part... |
|
|
Got PIC
Joined: 21 Mar 2008 Posts: 10
|
|
Posted: Fri Mar 21, 2008 10:25 pm |
|
|
PCM programmer;
I'm not sure if I can use you example if I'm already using the STREAM for both UARTS????
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,ERRORS, stream=No_Parity)
#use rs232(baud=9600,parity=O,xmit=PIN_C6,rcv=PIN_C7,bits=8,ERRORS, stream=Odd_Parity) |
|
|
|
|
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
|
Powered by phpBB © 2001, 2005 phpBB Group
|