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

Convert from PBASIC 2.5 to CCS-C

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



Joined: 23 Apr 2004
Posts: 227
Location: The Netherlands

View user's profile Send private message

Convert from PBASIC 2.5 to CCS-C
PostPosted: Sun Mar 12, 2006 10:17 am     Reply with quote

I need some help with converting from PBASIC

with CCS-C command (procedure) can i used to convert the SHIFTOUT command to CCS C


Code:
' ==================================================================
'                 HCMS-2900 SETUP SUBROUTINE
' ==================================================================

DSPreset:
   LOW      DSP_CS               ' Activate the Display.
   HIGH   DSP_BLANK            ' Not necessary but clear
   LOW      DSP_RESET               ' RESET.
   PAUSE   5
   HIGH   DSP_RESET            ' Normal Display is now sleeping
   ' clear all the dots
   LOW      DSP_RS               ' Select DOT register
   FOR temp=1 TO 40   ' 5 bytes/char * 8 char
      SHIFTOUT DATA_,CLK,MSBFIRST,[0\8]   ' Send All Blanks for each COL.
   NEXT
   HIGH   DSP_CS                  ' Copy data to dot latch step 1.
   LOW      CLK                  ' Copy data to dot latch step 2.
   ' next step the 2 control registers start with the first
   HIGH   DSP_RS               ' select the Control Register
   LOW      DSP_CS               ' Activate the Display again.
   SHIFTOUT DATA_,CLK,MSBFIRST,[DSP_CONTROL_0]   ' Send Data bits.
   HIGH   DSP_CS                  ' Copy data to control latch step 1.
   LOW      CLK                  ' Copy data to control latch step 2.
   ' Now the 2nd control register
   HIGH   DSP_RS               ' select the Control Register
   LOW      DSP_CS               ' Activate the Display again.
   SHIFTOUT DATA_,CLK,MSBFIRST,[DSP_CONTROL_1]   ' Send Data bits.
   HIGH   DSP_CS                  ' Copy data to control latch step 1.
   LOW      CLK                  ' Copy data to control latch step 2.
   LOW DSP_BLANK   'Show what is in the DOT registers NOTHING!


RETURN                     ' Return to program.

The Puma



Joined: 23 Apr 2004
Posts: 227
Location: The Netherlands

View user's profile Send private message

PostPosted: Sun Mar 12, 2006 12:12 pm     Reply with quote

Is this any good ???

Code:
// shift out 8-bits in data MSB first
void send_byte(int data) {
   int i;

   for(i=0;i<8;i++) {
      output_bit(HCMS2911_DIN,data & 0x80);
      output_high(HCMS2911_CLK);
      output_low(HCMS2911_CLK);
      data=data<<1;
   }
}
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