Das Open-Control-Projekt - Die Alternative zur C-Control-I


Das Forum zur C-Control-1
Welche C-Control-Varianten existieren?
Übersicht - Suchen - Neueste 50 Beiträge - Neuer Beitrag - Login - Registrieren
INFO - FAQ - CC2-Forum - CCPro-Forum 

 64 BYTE EXTRA VARIABLE RAM for CC1M2.01 with CC1AB2.0 Kategorie: C-Control I V1.2/2.0 (von Windt H.J. - 21.10.2004 1:00)
'----------------------------------------------------------------------------------------------------'
'***********************************************************************'
'*                         WINDT SYSTEMS                               *'
'*        64 BYTE EXTRA VARIABLE RAM for CC1M2.01 with CC1AB2.0        *'
'*                           H.J. WINDT                                *'
'*                             2004                                    *'
'***********************************************************************'
'----------------------------------------------------------------------------------------------------'
'This program demonstrates storing variables in the 64 bytes of CG RAM located in the LCD mounted'
'on the Application Board 2.0'
'Writing to or reading from the CG RAM will NOT disturb the characters displayed on the LCD'
'in any way because displayed characters are stored in the DD RAM of the LCD.'
'CG RAM is usually used by the programmer to create his or her own characters,'
'(C)haracter (G)eneration, but can be used to store data.'
'So, if you need to store variables in a RAM and are not planning to create you own characters then'
'feel free to use this software!!'
'For demonstration purpose use a terminal program like the one I found >>'
'RS232 TERMINAL at www.b-kainka.de/pcmessfaq.htm'
'----------------------------------------------------------------------------------------------------'
'*************** INS and OUTS ***************'
'-----port 2 lcd connections-----'
define db4 port[9]  'databus 4'
define db5 port[10] 'databus 5'
define db6 port[11] 'databus 6'
define db7 port[12] 'databus 7'
define rw port[13] '0 = write to lcd display / 1 = read from lcd display'
define rs port[14] '0 = command / 1 = data'
define en port[15] '1 to 0 = enable'
define lcd_light_off port[16] '(off)0 = light on / (on)1 = light off'
'*******************************************'
'**************** VARIABLES ****************'
define data byte[1]'data / used for translating byte into bits and vice versa for I/O of port 2 (lcd port), -'
define bit1 bit[1] '- needed because of a bug in the CC1 M2.01 system'
define bit2 bit[2]
define bit3 bit[3]
define bit4 bit[4]
define bit5 bit[5]
define bit6 bit[6]
define bit7 bit[7]
define bit8 bit[8]

define adr byte[2] 'address code'
define cmd byte[3] 'command code'
define dat byte[4] 'data code'
define number byte[5]
'*******************************************'
'**************** CONSTANTS ****************'

'*******************************************'
'****************** SETUP ******************'

print"#ON_LCD#";:print"#INIT#";:print"#CLR#";:print" 64 BYTE EXTRA  ";:print"#L201#";:print" VARIABLE RAM!  ";:print"#OFF#";
lcd_light_off = 0
beep 4,2,4: beep 4,2,4
'*******************************************'
'***************** PROGRAM *****************'
#start
print" Please enter 0 to write byte or 1 to read byte "
gosub input_number_via_232
if number > 1 then goto start
on number goto write_byte, read_byte

#write_byte
#get_address_to_write_to
print"Enter address (0 to 63)"
gosub input_number_via_232
if number > 63 then goto get_address_to_write_to
adr = number
#get_data_to_write
print"Enter number (0 to 255) to be written to address ";adr
gosub input_number_via_232
dat = number
gosub data_to_CG_ram_lcd
print"     SAVED!"
goto start

#read_byte
#get_address_to_read_from
print"Enter address (0 to 63)"
gosub input_number_via_232
if number > 63 then goto get_address_to_read_from
adr = number
gosub data_from_CG_ram_lcd
print"Data in address ";adr;"  =  ";dat
goto start


#input_number_via_232
number = 0
get data                                             'get 8 bit ascii code'
if data = 13 then return                             'look for ascii code for '
#input_positive_dec
data = data - 48                                                   'translate ascii code into decimal'
if number <> 0 then number = number * 10 + data else number = data 'build number'
get data                                                           'get 8 bit ascii code'
if data = 13 then return                                           'look for ascii code for '
goto input_positive_dec
'*******************************************'
#command_to_lcd
deact db7:deact db6:deact db5:deact db4:rw = 0:rs = 0:en = 0                                        'setup for transmitting command to lcd display'
data = &b00000000 or cmd shr 4:db7 = bit4:db6 = bit3:db5 = bit2:db4 = bit1:pulse en                 'HIGH NIBBLE command to lcd'
data = &b00000000 or (cmd - (cmd shr 4 shl 4)):db7 = bit4:db6 = bit3:db5 = bit2:db4 = bit1:pulse en 'LOW NIBBLE command to lcd'
return
'*******************************************'
#data_to_CG_ram_lcd
cmd = &b01000000 or adr : gosub command_to_lcd
deact db7:deact db6:deact db5:deact db4:rw = 0:rs = 1:en = 0                                        'setup for transmitting data to lcd display'
data = &b00000000 or dat shr 4:db7 = bit4:db6 = bit3:db5 = bit2:db4 = bit1:pulse en                 'HIGH NIBBLE data to lcd'
data = &b00000000 or (dat - (dat shr 4 shl 4)):db7 = bit4:db6 = bit3:db5 = bit2:db4 = bit1:pulse en 'LOW NIBBLE data to lcd'
return
'*******************************************'
#data_from_CG_ram_lcd
cmd = &b01000000 or adr : gosub command_to_lcd
deact db7 : deact db6 : deact db5 : deact db4:rw = 1:rs =1 : en = 1    'setup for reading data'
bit4 = db7:bit3 = db6:bit2 = db5:bit1 = db4:data = data shl 4          'HIGH NIBBLE data from lcd'
pulse en:bit4 = db7:bit3 = db6:bit2 = db5:bit1 = db4:en = 0            'LOW NIBBLE data from lcd'
dat = data
command_to_lcd
return
'*******************************************'
'****************** DATA *******************'

'*******************************************'



 Antwort schreiben

Bisherige Antworten:

Re: 64 BYTE EXTRA VARIABLE RAM for CC1M2.01 with CC1AB2.0 (von Windt H.J. - 22.10.2004 1:22)
Did you try it for CC1M1.x? (von Topmail - 21.10.2004 18:06)
Re: 64 BYTE EXTRA VARIABLE RAM for CC1M2.01 with CC1AB2.0 (von Carsten - 21.10.2004 9:16)
    Re: 64 BYTE EXTRA VARIABLE RAM for CC1M2.01 with CC1AB2.0 (von Windt H.J. - 21.10.2004 10:59)