![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
hmmpic
Joined: 09 Mar 2010 Posts: 314 Location: Denmark
|
RS232 FLOAT_HIGH? [Confirmed as bug by CCS...] |
Posted: Tue Mar 15, 2022 2:53 am |
|
|
[Update. CCS confirmed it as a bug, fixed in next release they say.]
Need my software RS232 to go Low, and Float, NO High.
From CCS:
FLOAT_HIGH - The line is not driven high. This is used for open collector outputs. Bit 6 in RS232_ERRORS is set if the pin is not high at the end of the bit time.
CCS 5.105 & 5066
Then i see this
03D58: BCF TRISC.3 -> Output
03D5A: BSF LATC.3 ->Go High
Code: |
#useRS232(Baud=1200,PARITY=N,XMIT=PIN_c3,BITS=8,TIMEOUT=10,STREAM=pdebug,ERRORS,FORCE_SW,DISABLE_INTS,INVERT,FLOAT_HIGH) //software com for production test on the IR led.
*
03D52: MOVFF INTCON,03
03D56: BCF INTCON.GIEH
03D58: BCF TRISC.3 -> Output
03D5A: BSF LATC.3 ->Go High
03D5C: MOVLW 08
03D5E: MOVWF @01
03D60: BRA 3D62
03D62: NOP
03D64: BSF 01.7
03D66: BRA 3D98
03D68: BCF 01.7
03D6A: MOVLB 4
03D6C: RRCF ??65535,F
03D6E: MOVLB 0
03D70: BNC 3D78
03D72: BCF LATC.3
03D74: BCF TRISC.3
03D76: BRA 3D7A
03D78: BSF TRISC.3
03D7A: BSF 01.6
03D7C: BRA 3D98
03D7E: BCF 01.6
03D80: BTFSS TRISC.3
03D82: BRA 3D8C
03D84: BTFSC PORTC.3
03D86: BRA 3D8E
03D88: BSF rs232_errors.6
03D8A: BRA 3DBA
03D8C: NOP
03D8E: DECFSZ @01,F
03D90: BRA 3D6A
03D92: BRA 3D94
03D94: NOP
03D96: BCF TRISC.3
03D98: MOVLW 02
03D9A: MOVWF @00
03D9C: CLRF FSR0L
03D9E: DECFSZ FSR0L,F
03DA0: BRA 3D9E
03DA2: DECFSZ @00,F
03DA4: BRA 3D9C
03DA6: MOVLW 20
03DA8: MOVWF FSR0L
03DAA: DECFSZ FSR0L,F
03DAC: BRA 3DAA
03DAE: BRA 3DB0
03DB0: NOP
03DB2: BTFSC 01.7
03DB4: BRA 3D68
03DB6: BTFSC 01.6
03DB8: BRA 3D7E
03DBA: BTFSC 03.7
03DBC: BSF INTCON.GIEH
03DBE: RETURN 0
|
Last edited by hmmpic on Fri Mar 18, 2022 1:51 am; edited 2 times in total |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9168 Location: Greensville,Ontario
|
|
Posted: Tue Mar 15, 2022 5:37 am |
|
|
You should post which PIC, the pin may not be able to be FLOATed either physically or as a 'software UART' ?? |
|
![](templates/subSilver/images/spacer.gif) |
hmmpic
Joined: 09 Mar 2010 Posts: 314 Location: Denmark
|
|
Posted: Tue Mar 15, 2022 6:30 am |
|
|
18F26K22
Look at this:
Code: |
03D58: BCF TRISC.3 -> Output
03D5A: BSF LATC.3 ->Go High
|
|
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9168 Location: Greensville,Ontario
|
|
Posted: Tue Mar 15, 2022 6:55 am |
|
|
hmm, wondering if you have to disable the other peripherals 'attached' to that pin like the ADC or MSSP ??
I'm sure others KNOW for sure.... |
|
![](templates/subSilver/images/spacer.gif) |
hmmpic
Joined: 09 Mar 2010 Posts: 314 Location: Denmark
|
|
Posted: Tue Mar 15, 2022 7:55 am |
|
|
Nop, it is CCS startup-code for the RS232. Nothing i can do.
#useRS232(Baud=1200,PARITY=N,XMIT=PIN_c3,BITS=8,TIMEOUT=10,STREAM=pdebug,ERRORS,FORCE_SW,DISABLE_INTS,INVERT,FLOAT_HIGH) //software com for production test on the IR led.
I suggest CCS made a new param for the useRS232. Call it "SIMPLE_FLOAT" no check and all that stuff, just float. |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9168 Location: Greensville,Ontario
|
|
Posted: Tue Mar 15, 2022 8:13 am |
|
|
even better, an 'option=just_work'
where it magically figures out everything needed to work as you need it to ![Smile](images/smiles/icon_smile.gif) |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19358
|
|
Posted: Tue Mar 15, 2022 9:00 am |
|
|
As always the big problem is lots of PIC's with different abilities.
FLOAT_HIGH historically only worked on software RS232. The manual entry
saying this was removed when some of the newer PICs, offered
programmable open collector drives on pins.
This PIC is not one offering this. CCS on these 'assume' a traditional
PIC where the pin can still be driven by turning off the TRIS. Unfortunately
on most of the mid-aqe PIC's, when a peripheral is enabled, this overrides
the TRIS.
So currently FLOAT_HIGH will only work on:
Software serial.
New PIC's with open collector drives.
Old PIC's where the TRIS has to be set for the serial to work. |
|
![](templates/subSilver/images/spacer.gif) |
hmmpic
Joined: 09 Mar 2010 Posts: 314 Location: Denmark
|
|
Posted: Wed Mar 16, 2022 2:05 am |
|
|
Maybe see my first post:-)
#useRS232(Baud=1200,PARITY=N,XMIT=PIN_c3,BITS=8,TIMEOUT=10,STREAM=pdebug,ERRORS,FORCE_SW,DISABLE_INTS,INVERT)
Only thing i miss is the floating pin, not high. It is not related to any hardware it is pure software. And this function is missing in the software uart.
I solved it in my hardware with a diode:-) |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19358
|
|
Posted: Wed Mar 16, 2022 2:07 am |
|
|
I'd be very surprised if 'float_high' will work with 'invert'.
With invert, the default idle state is low, not high.....
Also understand the key part of the word 'FLOAT'. The line is undriven.
It'll only go high if you have a pull up resistor on it.
The point is that the 'idle' state between the bytes is done by turning the
drive off, so the line floats. With invert the compiler can't understand what
is wanted.
Simplest thing is just immediately after each byte is output set the pin to
float. So:
Code: |
#useRS232(Baud=1200,PARITY=N,XMIT=PIN_c3,BITS=8,TIMEOUT=10,STREAM=pdebug,ERRORS,FORCE_SW,DISABLE_INTS,INVERT) //software com for production test on the IR led.
void myputcdebug(char val)
{
fputc(char);
output_float(PIN_C3);
}
|
Then just send your data to myputcdebug. |
|
![](templates/subSilver/images/spacer.gif) |
hmmpic
Joined: 09 Mar 2010 Posts: 314 Location: Denmark
|
|
Posted: Fri Mar 18, 2022 1:52 am |
|
|
[Update. CCS confirmed it as a bug, fixed in next release they say.]
I have the bug in: 5105 & 5066. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19358
|
|
Posted: Fri Mar 18, 2022 3:08 am |
|
|
Good.
I don't think it had 'occurred' to them, that somebody might want to use
'float_low'. So not surprised it didn't work.
Just use the proposed fix for now (this will give the same behaviour). If
you set the call up to with a macro, you can then switch to the fixed
code with a one line change. ![Smile](images/smiles/icon_smile.gif) |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|