CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug Reports on this forum. Send them to support@ccsinfo.com

RS232 FLOAT_HIGH? [Confirmed as bug by CCS...]

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
hmmpic



Joined: 09 Mar 2010
Posts: 312
Location: Denmark

View user's profile Send private message

RS232 FLOAT_HIGH? [Confirmed as bug by CCS...]
PostPosted: Tue Mar 15, 2022 2:53 am     Reply with quote

[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
temtronic



Joined: 01 Jul 2010
Posts: 8525
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Mar 15, 2022 5:37 am     Reply with quote

You should post which PIC, the pin may not be able to be FLOATed either physically or as a 'software UART' ??
hmmpic



Joined: 09 Mar 2010
Posts: 312
Location: Denmark

View user's profile Send private message

PostPosted: Tue Mar 15, 2022 6:30 am     Reply with quote

18F26K22

Look at this:
Code:

03D58:  BCF    TRISC.3 -> Output
03D5A:  BSF    LATC.3 ->Go High
temtronic



Joined: 01 Jul 2010
Posts: 8525
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Mar 15, 2022 6:55 am     Reply with quote

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....
hmmpic



Joined: 09 Mar 2010
Posts: 312
Location: Denmark

View user's profile Send private message

PostPosted: Tue Mar 15, 2022 7:55 am     Reply with quote

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.
temtronic



Joined: 01 Jul 2010
Posts: 8525
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Mar 15, 2022 8:13 am     Reply with quote

even better, an 'option=just_work'
where it magically figures out everything needed to work as you need it to Smile
Ttelmah



Joined: 11 Mar 2010
Posts: 18060

View user's profile Send private message

PostPosted: Tue Mar 15, 2022 9:00 am     Reply with quote

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.
hmmpic



Joined: 09 Mar 2010
Posts: 312
Location: Denmark

View user's profile Send private message

PostPosted: Wed Mar 16, 2022 2:05 am     Reply with quote

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:-)
Ttelmah



Joined: 11 Mar 2010
Posts: 18060

View user's profile Send private message

PostPosted: Wed Mar 16, 2022 2:07 am     Reply with quote

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.
hmmpic



Joined: 09 Mar 2010
Posts: 312
Location: Denmark

View user's profile Send private message

PostPosted: Fri Mar 18, 2022 1:52 am     Reply with quote

[Update. CCS confirmed it as a bug, fixed in next release they say.]

I have the bug in: 5105 & 5066.
Ttelmah



Joined: 11 Mar 2010
Posts: 18060

View user's profile Send private message

PostPosted: Fri Mar 18, 2022 3:08 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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