Dick Ivers
- 1st December 2014, 16:20
Hi,
I have a list of variables stored in eeprom. In the code example below there are four variables shown but in the final program there will be eight.
I have working code will allows each of the variables to be edited from a pc keyboard. The data is transmitted via hardware serial through serial-to-USB cable. It all works well.
The problem with the present code is that for each variable a value must be entered, even if no change is needed. The old value must be re-entered. If numbers are not keyed in prior to the enter keystroke the program will not proceed.
The process of re-entering the old values can get tedious when there is a long list of variables. So the question is this: Is there a way for the program to recognize an enter stroke without a preceding number and then just go ahead using the existing value stored in eeprom?
'write eeprom data.....done at program time not run time
eeprom 0,[0,0] 'default MTRplus = 0.0 seconds
EEProm 2,[0,0] 'default FlightT = 0.0 seconds
EEProm 4,[3,242] 'default Pos1Time = 101.0 seconds
EEProm 6,[1,244] 'default Pos1 = 500 ticks
'user programming with VT100 terminal
hserout [27,91,50,74] 'clear terminal screen
HSEROUT [27,91,72] 'go to start of text
READ 0,MTRplus.byte1
read 1,MTRplus.byte0
READ 2,FlightT.byte1
read 3,FlightT.byte0
READ 4,Pos1Time.byte1
read 5,Pos1Time.byte0
READ 6,Pos1.byte1
read 7,Pos1.byte0
hserout [27,91,50,74] 'clear terminal screen
HSEROUT [27,91,72] 'go to start of text
new: HSEROUT [" Motor Runtime",13,10]
HSEROUT [ " ",dec MTRplus/10,46,DEC MTRplus dig 0," Seconds",13,10,10]
hserout [" DT Time",13,10]
HSEROUT [ " ",dec FlightT/10,46,dec FlightT DIG 0," Seconds",13,10,10]
hserout [" Position #1 Time",13,10]
HSEROUT [ " ",dec Pos1Time/10,46,dec Pos1Time DIG 0," Seconds",13,10,10]
hserout [" Position #1 Angle",13,10]
HSEROUT [ " ",dec Pos1/10,dec Pos1 DIG 0," Ticks",13,10,10]
re: HSEROUT [" Enter New Motor Runtime x 10",13,10]
HSERIN [dec MTRplus] 'enter new MTRplus value if needed
write 0,MTRplus.byte1 'write new value to eeprom
write 1,MTRplus.byte0
HSEROUT [ " ",dec MTRplus/10,46,DEC MTRplus dig 0," Seconds",13,10,10]
re2: hserout [" Enter New DT Time x 10",13,10]
hserin [dec FlightT] 'enter new DT time value if needed
write 2,FlightT.byte1 'write new value to eeprom
write 3,FlightT.byte0
HSEROUT [ " ",dec FlightT/10,46,DEC FlightT dig 0," Seconds",13,10,10]
re3: hserout [" Enter New Position #1 Time x 10",13,10]
hserin [dec Pos1Time] 'enter new Pos time value if needed
write 4,Pos1Time.byte1 'write new value to eeprom
write 5,Pos1Time.byte0
HSEROUT [ " ",dec Pos1Time/10,46,DEC Pos1Time dig 0," Seconds",13,10,10]
re4: hserout [" Enter New Position #1 Angle x 10",13,10]
hserin [dec Pos1] 'enter new Pos1 if needed
write 6,Pos1.byte1 'write new value to eeprom
write 7,Pos1.byte0
hserout [27,91,50,74] 'clear terminal screen
hserout [27,91,72] 'go to start of text
hserout [10] 'move down 1 line
goto new 'print new values then unplug cable and restart
I have a list of variables stored in eeprom. In the code example below there are four variables shown but in the final program there will be eight.
I have working code will allows each of the variables to be edited from a pc keyboard. The data is transmitted via hardware serial through serial-to-USB cable. It all works well.
The problem with the present code is that for each variable a value must be entered, even if no change is needed. The old value must be re-entered. If numbers are not keyed in prior to the enter keystroke the program will not proceed.
The process of re-entering the old values can get tedious when there is a long list of variables. So the question is this: Is there a way for the program to recognize an enter stroke without a preceding number and then just go ahead using the existing value stored in eeprom?
'write eeprom data.....done at program time not run time
eeprom 0,[0,0] 'default MTRplus = 0.0 seconds
EEProm 2,[0,0] 'default FlightT = 0.0 seconds
EEProm 4,[3,242] 'default Pos1Time = 101.0 seconds
EEProm 6,[1,244] 'default Pos1 = 500 ticks
'user programming with VT100 terminal
hserout [27,91,50,74] 'clear terminal screen
HSEROUT [27,91,72] 'go to start of text
READ 0,MTRplus.byte1
read 1,MTRplus.byte0
READ 2,FlightT.byte1
read 3,FlightT.byte0
READ 4,Pos1Time.byte1
read 5,Pos1Time.byte0
READ 6,Pos1.byte1
read 7,Pos1.byte0
hserout [27,91,50,74] 'clear terminal screen
HSEROUT [27,91,72] 'go to start of text
new: HSEROUT [" Motor Runtime",13,10]
HSEROUT [ " ",dec MTRplus/10,46,DEC MTRplus dig 0," Seconds",13,10,10]
hserout [" DT Time",13,10]
HSEROUT [ " ",dec FlightT/10,46,dec FlightT DIG 0," Seconds",13,10,10]
hserout [" Position #1 Time",13,10]
HSEROUT [ " ",dec Pos1Time/10,46,dec Pos1Time DIG 0," Seconds",13,10,10]
hserout [" Position #1 Angle",13,10]
HSEROUT [ " ",dec Pos1/10,dec Pos1 DIG 0," Ticks",13,10,10]
re: HSEROUT [" Enter New Motor Runtime x 10",13,10]
HSERIN [dec MTRplus] 'enter new MTRplus value if needed
write 0,MTRplus.byte1 'write new value to eeprom
write 1,MTRplus.byte0
HSEROUT [ " ",dec MTRplus/10,46,DEC MTRplus dig 0," Seconds",13,10,10]
re2: hserout [" Enter New DT Time x 10",13,10]
hserin [dec FlightT] 'enter new DT time value if needed
write 2,FlightT.byte1 'write new value to eeprom
write 3,FlightT.byte0
HSEROUT [ " ",dec FlightT/10,46,DEC FlightT dig 0," Seconds",13,10,10]
re3: hserout [" Enter New Position #1 Time x 10",13,10]
hserin [dec Pos1Time] 'enter new Pos time value if needed
write 4,Pos1Time.byte1 'write new value to eeprom
write 5,Pos1Time.byte0
HSEROUT [ " ",dec Pos1Time/10,46,DEC Pos1Time dig 0," Seconds",13,10,10]
re4: hserout [" Enter New Position #1 Angle x 10",13,10]
hserin [dec Pos1] 'enter new Pos1 if needed
write 6,Pos1.byte1 'write new value to eeprom
write 7,Pos1.byte0
hserout [27,91,50,74] 'clear terminal screen
hserout [27,91,72] 'go to start of text
hserout [10] 'move down 1 line
goto new 'print new values then unplug cable and restart