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

Need somebody help to convert basic code to CCS

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



Joined: 11 Mar 2006
Posts: 2

View user's profile Send private message

Need somebody help to convert basic code to CCS
PostPosted: Sun Mar 19, 2006 4:03 am     Reply with quote

I have some code with basic need sombody to convert to CCS code

PIC 16F877 , 4 mhz

Code:
:
'DEFINE LOADER_USED 1

DEFINE OSC 4

DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h
DEFINE HSER_SPBRG 12 ' 19200 Bauds

IR   VAR   word
pulses  VAR     byte[33]
BitMask VAR     byte
i       VAR     byte            'loop index
b       VAR     byte            'byte index
LeadIn  VAR     word            'start pulse
a1      var     byte
a2      var     byte
TRISB = %00000001



star:
For i= 0 to 24 ' Do 12-bits
    'HSEROUT ["B ",DEC pulses[i],13,10]
NEXT
HSEROUT ["Bottom ",dec ir.lowbyte,13,10]
HSEROUT ["Comand ",dec IR.highbyte,13,10]
a1=ir.lowbyte
a2=ir.highbyte

   
loop:                                                                   
    'PulsIn GPIO.1, 0, LeadIn
    PulsIn Portb.0, 0, LeadIn                               
        If LeadIn < 855 Then loop
          If LeadIn > 1045 Then loop
      For i = 0 TO 24
          'PulsIn GPIO.1, 1, pulses[i]
          PulsIn Portb.0, 1, pulses[i]
         
      Next
        For i = 17 To 24
         
          If pulses[i] > 99 Then                                     
                    
            IR.0=1
   
          else
         
            IR.0=0
         
          endif
            ir = ir << 1
        Next
        Bitmask = ir
  goto star     
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