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

microchip C18 c compiler software RS232

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







microchip C18 c compiler software RS232
PostPosted: Fri Apr 30, 2004 2:45 am     Reply with quote

Hi, Friends,
I am now using microchip C18 controller and pic18f452.
This compiler does not have the #use rs232 directives, therefore i may need to write the software RS-232 communication protocol myself.
And my hardware uart is already in use by another communication channel.
Did any of you implement this before? Or do you have any sample codes?
Thanks.
Sigma
Sigma
Guest







PostPosted: Fri Apr 30, 2004 3:04 am     Reply with quote

By the way, i did see some posts using interrupt to achieve this. But could not see anyone using polling. Why? I like polling.
Sigma
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Fri Apr 30, 2004 3:23 am     Reply with quote

You can't sample exactly in the middle of the bits if you use polling, because you will need to generate exact delays using loops/delay_us() which is not practical.
This post may be a good starting point:
http://www.ccsinfo.com/forum/viewtopic.php?p=24470&highlight=#24470
dyeatman



Joined: 06 Sep 2003
Posts: 1912
Location: Norman, OK

View user's profile Send private message

C18 Resource
PostPosted: Fri Apr 30, 2004 6:25 am     Reply with quote

This site is a very good resource for code that should work for the C18 compiler (including the software RS232) and you would likely get more info there. C18 folks dont hang around here much...

http://www.microchipc.com/

You shoudl also try the microchip C18 programmers forum here:

http://forum.microchip.com/tt.asp?forumid=-2
Sigma
Guest







PostPosted: Mon May 03, 2004 7:30 pm     Reply with quote

Thx, all.
Sigma



Joined: 03 May 2004
Posts: 48
Location: Sg

View user's profile Send private message

PostPosted: Sun May 09, 2004 9:33 pm     Reply with quote

Hi, all,
I am now trying to convert the assembly code of AN555 to PIC C code, where i encountered a problem.
There is one section in the rs232.h i don't quite understand,
Code:
LOAD_RTCC   MACRO   Mode, K, Prescale

    if(UsePrescale == 0 && Mode == 0)
   movlw   -K + _Cycle_Offset1
    else
   movlw   -K + (_Cycle_Offset1 >> (Prescale+1))  ; Re Load RTCC init value + INT Latency Offset
    endif
   movwf   TMR0      ; Note that Prescaler is cleared when RTCC is written

      ENDM

The assembler does not understand LOAD_RTCC MACRO Mode, K,Prescale, and so do i. What does it mean? How could i use it under CCS compiler?
Thanks.
Sigma
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