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 CCS Technical Support

CCS v 5.115 Serial invert doen't work?

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



Joined: 28 May 2017
Posts: 80

View user's profile Send private message

CCS v 5.115 Serial invert doen't work?
PostPosted: Fri Nov 10, 2023 7:26 am     Reply with quote

Hey, I have trying to make a new program for PIC16F886.
It uses lot of messages from SIm900 GSM module.
I do no have SIM900 module yet and I have tried to simulate what SIM900 gives.
Sim900 gives at normal Uart way and I have tried to simulate it with PC serial device.
It needs that I place Uart in normal inverted with
#use rs232(baud=9600,xmit=PIN_C6, rcv=PIN_C7,errors, bits=8,invert ) .

I use 2k2 resistor in PC TX pin, so that it doesn't go to too high.
It doesn't works and I tried to make with PIC18F2620 a similar way, but only with UART way.
It doesn't work either. All the characters were moved to other characters or mode modified.

Then I modified the test circuit to normal RS232 circuit.

Now everything worked.

Has anybody found a similar problem?
I am used invert function many years, but I do not remember if I have used invert with this 5.115 version.

I put two schematics
One with inverted schematics http://probyte.fi/Testing.jpg
and with no inverted schematics http://probyte.fi/TestingA.jpg

Pekka Ritamaki
Ttelmah



Joined: 11 Mar 2010
Posts: 19477

View user's profile Send private message

PostPosted: Fri Nov 10, 2023 7:56 am     Reply with quote

You do realise that invert on this chip will imply you have to use software
serial?. The hardware does not support invert on this chip.
Try using FORCE_SW on the setup. I suspect because you are using
the hardware pins, the compiler gets confused about how to do this
(the older compilers automatically selected software mode if this was
selected). With newer chips now supporting hardware invert, this is no
longer the default.
Using software serial, the receive will be the issue. No buffering, and
you have to be waiting for each byte before it arrives.
pekka1234



Joined: 28 May 2017
Posts: 80

View user's profile Send private message

Nice
PostPosted: Fri Nov 10, 2023 10:13 am     Reply with quote

Thank you Thelmah

This works as I thought before!
Well it was in manual, but how I can read and test every page

>FORCE_SW - Generate software serial I/O routines even when UART pins

This enable_interrupts(GLOBAL); is not needed any more
Pekka

#include <18f2620.h>
#use delay(internal=8MHz,restart_wdt)
#use rs232(baud=9600,xmit=PIN_C6, rcv=PIN_C7,errors, bits=8, FORCE_SW,invert )
#FUSES NOWDT //No Watch Dog Timer
//#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES NOPROTECT //Code not protected from reading
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES BROWNOUT //Reset when brownout detected
#FUSES BORV21 //Brownout reset at 2.1V
#FUSES PUT //Power Up Timer
#FUSES NOCPD //No EE protection
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT //Program memory not write protected
//#FUSES NOWRTD //Data EEPROM not write protected
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES NOMCLR //Master Clear pin enabled
void main()
{
char value='a';
// enable_interrupts(GLOBAL);
while(TRUE)
{
printf("\r\nStart typing:%c\r\n",value);
value=getch();
delay_ms(10);
}
}
hmmpic



Joined: 09 Mar 2010
Posts: 314
Location: Denmark

View user's profile Send private message

PostPosted: Tue Nov 14, 2023 4:20 am     Reply with quote

I reported this problem whit float high in CCS version 5.105

This is from CCS date: 1703-22:
Code:
I reviewed the issue and determine it was a bug when both the INVERT and FLOAT_HIGH options are used.  For the combination the start bit was being driven high instead of being floated.  I have corrected the error and the fix will be in the next compiler release we do.


I dont know if it was fixed in 5.106 because i still use 5.105 with a work around. I only update if i really need to. (every new update solve some problem, but also left new problems open)
Ttelmah



Joined: 11 Mar 2010
Posts: 19477

View user's profile Send private message

PostPosted: Tue Nov 14, 2023 5:17 am     Reply with quote

I remember you reporting this. I checked with 5.106, and it was fixed.
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