View previous topic :: View next topic |
Author |
Message |
Andreas
Joined: 25 Oct 2004 Posts: 136
|
Software serial disable ? |
Posted: Thu Dec 17, 2015 1:37 am |
|
|
Hello friends
I have to use the Software Serial unit from the ccs compiler, which works already very fine !
BUT I also have to make it configurable in that way, that I have to be able to disable it and use this port pin for other functions !
Is there a clean way to disable the soft serial at run time ?
Any help appreciated.
best regards
Andreas |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19503
|
|
Posted: Thu Dec 17, 2015 2:17 am |
|
|
Just use the pins.
The software serial does nothing 'to' the hardware. It only acts on the pins when you use it. You can drive the pins just as normal.
It only reads the RX pin, when you do a kbhit, or a getc, and only writes to the TX pin when you do a putc. |
|
|
Andreas
Joined: 25 Oct 2004 Posts: 136
|
|
Posted: Sun Dec 20, 2015 8:45 am |
|
|
Hello Ttelmah
Thank you for the clarification, but I had the impression, that if I leave the Set Statement in , then i see some little distortion on an regular timer Interrupt which seems to go when removing the set Statement !?
I am not sure if this a correct impression.
Best regards
Andreas |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19503
|
|
Posted: Sun Dec 20, 2015 9:05 am |
|
|
'Set statement'?.
The only time #USE RS232 for a software unit has any effects on interrupts, is if you are configuring it to use an external interrupt, and enabling receive buffering, or if you select the 'DISABLE_INTS' option, and then only during the actual data transmission/reception. Or (of course), the 'old one' of having a putc/getc, both inside and outside an interrupt, when you will get the compiler warning 'interrupts disabled to prevent re-entrancy'. |
|
|
|