|
|
View previous topic :: View next topic |
Author |
Message |
GDetienne
Joined: 20 Sep 2003 Posts: 47 Location: Brussel - Belgium
|
#use rs232 question. |
Posted: Tue Jun 07, 2005 3:18 am |
|
|
With my 16F876A I use two serial port. The first one is the internal UART (C6 and C7) and works great.
The second one is initialized like as follow :
Code: | #use rs232(baud=4800,parity=N,xmit=PIN_C0,rcv=PIN_C1,stream=GPS,errors) |
After, in the main, in function of the state of an input port, I wish change the option of this port. Only add INVERT.
The help file say : "Invert : not be used with the internal UART."
The compiler don't give error, but when I read the lst file I don't see any code for this modification.
Code: | .................... if (cGPSinv == 1) // GPS TTL inverse
0504: DECFSZ 5C,W
0505: GOTO 506
.................... {
.................... #use rs232(baud=4800,parity=N,xmit=PIN_C0,rcv=PIN_C1,stream=GPS,errors,invert)
.................... }
....................
.................... if (cI2C == 0) // mode RS232
0506: MOVF 3D,F
|
Could you me say where is my error ? Thanks a lot.
(I use PCWM 3.217) |
|
|
Ttelmah Guest
|
|
Posted: Tue Jun 07, 2005 6:37 am |
|
|
Just define another stream.
So:
Code: |
#use rs232(baud=4800,parity=N,xmit=PIN_C0,rcv=PIN_C1,stream=GPS,errors)
#use rs232(baud=4800,parity=N,xmit=PIN_C0,rcv=PIN_C1,stream=GPSI,errors)
|
When you want to use the inverted form, select 'GPSI', instead of 'GPS'.
The 'stream' parameter, really makes the use of inline #use defintions obsolete, and many now seem to give problems. It seems that the default for the inline version, is to only work without the stream parameter, and to always replace the current stdio. Presumably the compiler is seeing the hardware port as being the current stdio port, so errors when it sees this trying to be changed...
Best Wishes |
|
|
GDetienne
Joined: 20 Sep 2003 Posts: 47 Location: Brussel - Belgium
|
|
Posted: Tue Jun 07, 2005 2:54 pm |
|
|
Thanks for your suggestion.
Regard. |
|
|
|
|
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
|