
|
INFO - FAQ - CC2-Forum - CCPro-Forum |
|
||
|
Hallo! Ich habe mal versucht den Code für die KS0073 Kontroller-Display's von CCBASIC in BASIC++ umzuwandeln. Kann mir bitte jemand der sich mit beidem auskennt kurz sagen, ob das in etwa die selbe funktion hat?? kann es leider im moment aus hardwaremangel nicht testen, brauche es aber am Wochenende :-( Wär super wenn mal jemand drüberschaut! ORIGINAL in CCBASIC: '------ I/O PORTS --------- '-------------------------- define LCDPORT byteport[2] '-------------------------- '---- SYSTEM MEMORY ------- '-------------------------- define OUTBYTE byte[1] define LCDDATA byte[2] print "#ON_LCD#"; print "#INIT#"; &h24 LCD_WRITECMD(&h24):pause 2 LCDDATA=&h09:gosub LCD_WRITECMD:pause 2 LCDDATA=&h20:gosub LCD_WRITECMD:pause 2 print "#ON_LCD#";"#INIT#"; LCDDATA=&h24:gosub LCD_WRITECMD:pause 2 LCDDATA=&h09:gosub LCD_WRITECMD:pause 2 LCDDATA=&h20:gosub LCD_WRITECMD:pause 2 print"#L101#";"Z1"; print"#L133#";"Z2"; print"#L165#";"Z3"; print"#L197#";"Z4"; '--------- ------WRITE HI NIBBLE LCD COMMAND ------------ #LCD_WRITECMD OUTBYTE=(LCDDATA shr 4) LCDPORT=OUTBYTE or &B01000000:LCDPORT=OUTBYTE and &B10111111 '--------------- WRITE LO NIBBLE ------------------------ OUTBYTE=(LCDDATA and &H0F) LCDPORT=OUTBYTE or &B01000000:LCDPORT=OUTBYTE and &B10111111 return '------------------------------------------------------- Mein Vorschlag für BASIC++: '////////////////////////////////////// '// '// CCBasic++ '// Destination C-Control I M2.0 '// Beschreibung: '// '////////////////////////////////////// OPTION CC2.0 'Zielplattform 'Deklarationen 'Define byte1 as byte[1] '------ I/O PORTS --------- '-------------------------- define LCDPORT byteport[2] '-------------------------- '---- SYSTEM MEMORY ------- '-------------------------- define OUTBYTE byte ' define LCDDATA byte[2] 'print "#ON_LCD#"; LCD.INIT 'print "#INIT#"; LCD_WRITECMD(24h) pause 2 LCD_WRITECMD(09h) pause 2 LCD_WRITECMD(20h) pause 2 'print "#ON_LCD#"; LCD.INIT 'print "#INIT#"; LCD_WRITECMD(24h) pause 2 LCD_WRITECMD(09h) pause 2 LCD_WRITECMD(20h) pause 2 'print"#L101#";"Z1"; LCD.POS 1,1 LCD.PRINT "Z1" 'print"#L133#";"Z2"; LCD.POS 1,33 LCD.PRINT "Z2" 'print"#L165#";"Z3"; LCD.POS 1,65 LCD.PRINT "Z3" 'print"#L197#";"Z4"; LCD.POS 1,97 LCD.PRINT "Z4" '--------- ------WRITE HI NIBBLE LCD COMMAND ------------ Function LCD_WRITECMD(LCDDATA as byte) 'define LCD_dat_hi as byte[2] 'LCD_dat_hi=LCDDATA shr 4 OUTBYTE=(LCDDATA shr 4) LCDPORT=OUTBYTE or 01000000b LCDPORT=OUTBYTE and 10111111b '--------------- WRITE LO NIBBLE ------------------------ OUTBYTE=(LCDDATA and 0Fh) LCDPORT=OUTBYTE or 01000000b LCDPORT=OUTBYTE and 10111111b end Function '------------------------------------------------------- |
| Antwort schreiben |