??? 08/06/11 12:13 Read: times |
#183231 - some comments on code Responding to: ???'s previous message |
void singecommandshout(unsigned char serialout); //new proc int init_driver() /*Driver initialisation program start here */ { //??????????????? not needed start(); //start command to HT16K33 //???????? to which I2C address/device You send this ? ////////////////shout(0x00); //display data address pointer singecommandshout(0x21); //Turns on internal oscillator singlecommandshout(0x81); //Display on blinking off singlecommandshout(0xef); //Dimming set to 16/16 ////////????????????? not needed stop(); ////////////////////SDA = 1; ///////////////////SCL = 1; } void singecommandshout(unsigned char serialout) {start(); shout(0xe0); //address of chip shout(serialout); stop(); } int outdata() /*Driver initialisation program start here */ { start(); //start command to HT16K33 shout(0xe0); //slave address shout(0x01); //command reg address byte display address set to 0x01 shout(0x55); //data byte 4 segnent turns on & 4 turns off stop(); //stop command ////////SDA = 1; //not needed /////////SCL = 1; //not needed } stop() //stop subroutine for HT16K33 { SDA = 0; SCL = 1; _nop_(); SDA = 1; _nop_(); _nop_(); _nop_(); } start() //start subroutine for HT16K33 { SDA = 1; SCL = 1; _nop_(); SDA = 0; _nop_(); _nop_(); SCL = 0; _nop_(); } int shout(unsigned char serialout) //Data transfer to HT16K33 subroutine { unsigned char eepromcounter; eepromcounter = 0x08; //8 bit data transmission so counter loaded with 0x08 while(eepromcounter) //while counter does not become 0 out data to 16K33 { //?????????? //Are You Sure that CY receives bit 7 in shifting below?????? // It can be , nbut depends on compiler, compiler can do this // without C flag: // mov a,serialout // rl a // anl a,#0feh // mov serialout,a serialout = serialout << 1; //left shift datareg _nop_(); SDA = CY; //move carry on SDA line //better is if (serialout && 0x80) SDA=1 else SDA=0; serialout=serialout<<1; _nop_(); SCL = 1; //give clock pulse _nop_(); _nop_(); _nop_(); _nop_(); SCL = 0; --eepromcounter; //decrement the counter by 1 } SDA = 1; //make SDA high _nop_(); _nop_(); SCL = 1; //give clock pulse _nop_(); _nop_(); SCL = 0; } |
Topic | Author | Date |
Driving HT16K33 using 89S52 | 01/01/70 00:00 | |
How to post legible source code | 01/01/70 00:00 | |
HLL Delay Routines - beware!! | 01/01/70 00:00 | |
modified code | 01/01/70 00:00 | |
How do you think that will help?? | 01/01/70 00:00 | |
some comments on code | 01/01/70 00:00 | |
testing of new code | 01/01/70 00:00 | |
HLL Delay Routines | 01/01/70 00:00 | |
one thing | 01/01/70 00:00 | |
CY in C ? _NOT_ | 01/01/70 00:00 | |
I'll use new code. | 01/01/70 00:00 | |
Getting success | 01/01/70 00:00 | |
one modification | 01/01/70 00:00 | |
For How Long? | 01/01/70 00:00 | |
No need to use that instruction | 01/01/70 00:00 | |
Start by caring about the C standard | 01/01/70 00:00 | |
Learning the 'C' programming language | 01/01/70 00:00 | |
C Language Supports No Carry Bits | 01/01/70 00:00 | |
Talking to HT16K33 | 01/01/70 00:00 |