Serial LED 7 Segment 5inches
User Manual: Serial LED 7 segment 5inches
Open the PDF directly: View PDF .
Page Count: 16
Download | |
Open PDF In Browser | View PDF |
[STX] – Start of transmission marker, ASCII value = 0x02 [ETX] – End of transmission marker, ASCII value = 0x03 Transmission Format: [STX]+5+T+[ETX] ‘correct way to send [STX] & ETX marker Serial1.print(chr(2)+”5T”+chr(3)) Serial1.print(“[STX]5R[ETX]”) ‘WRONG! // correct way to send [STX] Serial.write(0x02); // Address=5, T = test command Serial.print(“5T”); // [ETX] marker Serial.write(0x03); Serial.print(“[STX]5T[ETX]”); // WRONG! Serial.print(“\0025T\003”); // where “\002” = STX, “\003” = ETX //CRC-8 - based on the CRC8 formulas by // Dallas/Maxim //code released under the terms of the // GNU GPL 3.0 license uint8_t crc8_update(uint8_t crc, uint8_t data) { uint8_t updated = crc ^ data; for (uint8_t i = 0; i < 8; ++i) { if ((updated & 0x80 ) != 0) { updated <<= 1; updated ^= 0x07; } else { updated <<= 1; } } return updated; } uint8_t cal_crc8(char *txstring){ uint8_t crc=0; char *txptr=txstring; while(*txptr !=0){ crc=crc8_update(crc,(uint8_t)*txptr); txptr++; } return(crc | 0x80); // see text } // comment out if you do not wish to enable crc checking #define CRC_ENABLE /* * Send a packet to Serial Display unit * The packet is wrapped with STX and ETX markers as required by the * Serial Display Unit * txstring - message string to send */ #define #define STX 0x02 ETX 0x03 void send_to_display(char addr, char *txstring){ uint8_t crc=0; char *txptr=txstring; #ifdef CRC_ENABLE //compute for crc8 crc=crc8_update(crc,addr+0x30); // include device id in the calculation while(*txptr !=0){ //Serial.print(*txptr,HEX); crc=crc8_update(crc,(uint8_t)*txptr); txptr++; } crc |= 0x80; #endif Serial.write(STX); Serial.write(addr+0x30); Serial.print(txstring); #ifdef CRC_ENABLE Serial.write(crc); #endif Serial.write(ETX); } #define LEDADDR 5 // setting // led controller device ID. Change according to your own /* * Initialize and test Serial Display unit */ void init_display(void){ // setup serial LED for 16 panels send_to_display(LEDADDR,"P0"); // 0=16 panels delay(500); send_to_display(LEDADDR,"T"); // segment test, turns ON all segment for a second delay(1000); #ifdef CRC_ENABLE // enable crc checking send_to_display(LEDADDR,"_CRC"); #endif } send_to_display(LEDADDR,”C”); send_to_display(LEDADDR,”D53587”); send_to_display(LEDADDR,”D163.14156”);
Source Exif Data:
File Type : PDF File Type Extension : pdf MIME Type : application/pdf PDF Version : 1.4 Linearized : No Page Count : 16 XMP Toolkit : XMP toolkit 2.9.1-13, framework 1.6 About : uuid:aabd61b5-7b1e-11e7-0000-a0cd956e24ad Producer : GPL Ghostscript 9.06 Modify Date : 2017:08:04 11:15:29+08:00 Create Date : 2017:08:04 11:15:29+08:00 Creator Tool : Adobe Acrobat 17.9.0 Document ID : uuid:aabd61b5-7b1e-11e7-0000-a0cd956e24ad Format : application/pdf Title : Serial LED 7 segment 5inches.pdf Creator : bok pogi Author : bok pogiEXIF Metadata provided by EXIF.tools