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

US2066 Driver.

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



Joined: 19 May 2018
Posts: 27

View user's profile Send private message

US2066 Driver.
PostPosted: Thu Jul 02, 2020 1:11 pm     Reply with quote

Anyone know of a US2066 Driver ? I'm messing around with a 4x20 NHD oled with no luck.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jul 03, 2020 1:55 pm     Reply with quote

This one can be easily translated to CCS:
https://github.com/NewhavenDisplay/NHD_US2066

DigitalWrite() in Arduino translates to output_bit() in CCS.
Delay() in Arduino translates to delay_ms() in CCS.

Example:

Arduino code:
Code:

void command(unsigned char c)
{
  unsigned char i, temp;
  switch(mode)
  {
    case 0:   digitalWrite(CS, LOW);
              PORTA = c;
              digitalWrite(RS, LOW);
              digitalWrite(E, HIGH);
              delay(1);
              digitalWrite(E, LOW);
              digitalWrite(CS, HIGH);
    break;

Translated to CCS:
Code:

#define LOW 0
#define HIGH 1

#define CS  PIN_B0   // Or whatever pins you are using for it
#define RS  PIN_B1
#define E   PIN_B2

#byte PORTA = getenv("SFR:PORTA")  // Use LATA if using PIC18F
unsigned char mode = 0; // 0 = 8-bit parallel 6800 mode; 1 = i2c mode; 2 = SPI mode;
const char slave2w = 0x78;  // CCS uses 8-bit slave address


void command(unsigned char c)
{
unsigned char i, temp;

switch(mode)
  {
    case 0:  output_bit(CS, LOW);
             PORTA = c;
             output_bit(RS, LOW);
             output_bit(E, HIGH);
             delay_ms(1);
             output_bit(E, LOW);
             output_bit (CS, HIGH);
    break;

  }
}
daveh



Joined: 30 Aug 2013
Posts: 19

View user's profile Send private message

PostPosted: Wed Dec 07, 2022 6:03 am     Reply with quote

http://www.ccsinfo.com/forum/viewtopic.php?t=59920&start=0&postdays=0&postorder=asc&highlight=us2066

I posted driver code here
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