Shop OBEX P1 Docs P2 Docs Learn Events
help asap please, grovel, beg etc. — Parallax Forums

help asap please, grovel, beg etc.

ArchiverArchiver Posts: 46,084
edited 2001-02-03 16:17 in General Discussion
help asap please, grovel, beg etc.

Hi all,

here is part of my program:

screendata:
·beginn ······· DATA 12,14,16,69,"PS200c",16,84,"Ver 2.1c",0
·count_forms··· DATA 12,14,16,68,"Count: ",0
·entry_sensor·· DATA 16,80,"· Entry Sensor",0
·exit_sensor··· DATA 16,80,"·· JAM AT EXIT",0
·covers ······· DATA 16,80,"·· COVER OPEN··· ",0
·loopsw ······· DATA 16,80,"· Loop Switch",0
·limitsw······· ······· DATA 16,80," Limit Reached",0
·long_form····· ······· DATA 16,80,"· Lengthen Form",0
·short_form···· ······· DATA 16,80,"· Shorten Form",0
' batch ······· DATA 12,14,16,66,"Batch every:",0
' speed_pos···· ······· DATA 16,80,"Set speed to MIN",0
·folder_jam···· ······· DATA 16,80," JAM IN FOLDER",0
' not_burst···· ······· DATA 16,80,"FORMS NOT BURST",0
·ready_to_go··· DATA 16,80,"···· READY··· ",0
·running_machine······· DATA 16,80,"··· RUNNING",0
·
setup:· ······· ······· ······· ······· ······· ······· ······· ······· ······· ' DECLARE VARIABLES
·forms_count_low ······ VAR word······· ······· ······· ······· ······· ······· ······· ' forms counter low word ie to 9999

·forms_count_high······ VAR nib ······· ······· ······· ······· ······· ······· ' forms counter ten-thousands ie 99999
·life_count···· ······· VAR word······· ······· ······· ······· ······· ······· ······· ' life time forms counter (in thousands)······· ······· ······· ······· ······· ······· ·······

·sw_held······· ······· VAR byte······· ······· ······· ······· ······· ······· ······· ' memory space for sw. held test

·cont_flag····· ······· VAR bit
·button_data··· VAR byte······· ······· ······· ······· ······· ······· ······· ' memory space for sw. data
·jam_counter··· VAR byte······· ······· ······· ······· ······· ······· ······· ' memory space for exit crash time
·previous······ ······· VAR word
·addr·· ······· ······· VAR word
·char·· ······· ······· VAR byte
·result ······· VAR word
·speed· ······· VAR word
·forms_in_system······· VAR byte
·setdata ······ ······· VAR byte
·indata ······· VAR byte······· ······· ······· ······· ······· ······· ······· ······· ········
·
·insensor······ ······· VAR indata.bit0
·ip13·· ······· ······· VAR indata.bit1
·ip14·· ······· ······· VAR indata.bit2
·minus· ······· VAR indata.bit3
·plus·· ······· ······· VAR indata.bit4
·loopsw1······· ······· VAR indata.bit5
·loopsw2······· ······· VAR indata.bit6
·limits ······· VAR indata.bit7

·outdata ······ ······· VAR byte ······ ······· ······· ······· ······· ······· ······· ·······
·go···· ······· ······· VAR outdata.bit0
·feed_clutch··· VAR outdata.bit1
·op3··· ······· ······· VAR outdata.bit2
·forward······· ······· VAR outdata.bit3
·auto_man······ ······· VAR outdata.bit4
·op6··· ······· ······· VAR outdata.bit5
·op7··· ······· ······· VAR outdata.bit6
·backward······ ······· VAR outdata.bit7

·N9600· ······· CON 16624 ····· ······· ······· ······· ······· ······· ' Setup serial comms speed for display

·MISO·· ······· ······· CON 15· ······· ········ ······ ······· ······· ······· ' master IN slave OUT pin
·MOSI·· ······· ······· CON 14· ······· ······· ······· ······· ······· ······· ' master OUT slave IN pin
·SCK··· ······· ······· CON 13· ······· ······· ······· ······· ······· ······· ' serial Clock I/P
·CE···· ······· ······· CON 12
·start_sw······ ······· CON 4
·select_sw····· ······· CON 5
·reset_sw······ ······· CON 6
·stop_sw······· ······· CON 7
·coversw······· ······· CON 8
·out_sensor···· ······· CON 9

' ************************* INITIALIZE VARIABLES **************************

·HIGH CE······· ······· ······· ······· ······· ······· ······· ······· ······· ······· ' Set I/O chips disable chip
·setdata=%11111110: outdata=%11111110: GOSUB transfer_out······ ······· ' Configure O/P port
·setdata=%00111010: outdata=%00000000: GOSUB transfer_out······ ······· ' Configure I/P port
·sw_held=0: cont_flag=0: button_data=0
·forms_in_system=0
·result=0
·speed=0
·outdata=%11111100
·forms_count_low=0
·forms_count_high=0
·GOSUB data_read
·life_count.lowbyte=0
·life_count.highbyte=0
·GOSUB read_life_count
· .
· .
· .
· .
·addr=count_forms······ ······· ······· ······· ······· ······· ······· ······· ······· ' address of message
·GOSUB displayit······· ······· ······· ······· ······· ······· ······· ······· ······· ' send message to LCD
· .
· .
· .
· displayit:··· ······· ······· ······· ······· ······· ······· ······· ······· ······· ' ROUTINE TO SEND MESSAGES TO LCD

·READ addr, char······· ······· ······· ······· ······· ······· ······· ······· ······· ' read address and message contents

·IF char=0 THEN printitdone···· ······· ······· ······· ······· ······· ······· ' if character=0 then end of message
·SEROUT 0,N9600,[noparse][[/noparse]char]· ······· ······· ······· ······· ······· ······· ······· ' send to LCD message 1 char @ a time
·addr=addr+1··· ······· ······· ······· ······· ······· ······· ······· ······· ' add 1 to memory position
·GOTO displayit ······· ······· ······· ······· ······· ······· ······· ······· ' carry on
·printitdone:
RETURN

· .
· .
· .

counter:······· ······· ······· ······· ······· ······· ······· ······· ······· ······· ' FORMS COUNTER AND CRASH DETECTION AT EXIT SENSOR

·forms_count_low=forms_count_low+1//10000······ ······· ······· ······· ······· ' add 1 to count
·forms_count_high=forms_count_high+1 -(forms_count_low MAX 1)//10······ ' add 1 to tens of thousands after 9999 roll to 0 after 99999

·SEROUT 0,N9600,[noparse][[/noparse]16,80,18,"5",DEC forms_count_high,DEC4 forms_count_low,4]· ··· ······· ' R-justify show count
·life_count=(life_count+1)/1000 ······· ······· ······· ······· ······· ' add 1 to life counter divide 1000
· .
· .
· .
data_capture:
·WRITE 150,forms_count_low.lowbyte
·WRITE 160,forms_count_low.highbyte
·WRITE 170,forms_count_high
·WRITE 180,life_count.lowbyte
·WRITE 190,life_count.highbyte
RETURN

data_read:
·READ 150,forms_count_low.lowbyte
·READ 160,forms_count_low.highbyte
·READ 170,forms_count_high
RETURN

read_life_count:
·READ 180,life_count.lowbyte
·READ 190,life_count.highbyte
RETURN

My problem is that the messages I'm sending to a LCD are being corrupted.· I'm pretty sure it's due to the way I'm writing the counter values to eeprom., by virtue that it only started when I added these bits to the program.

What am I doing wrong?· Am I just expecting to much from the BS2sx eeprom?

Any help greatfully received

cheers

Jon

PRESSURE SEAL GROUP
Tel:··· + 44 (0) 1962 735 777
Fax:··· + 44 (0) 1962 734 555
Mobile: + 44 (0) 7979 426 769
Email:· jonm@pseal.co.uk
__________________________
This communication including any attachments is for the sole use of the addressee and may be confidential and/or contain information subject to legal privilege and is for the use of the intended recipient only. It must not be disclosed or re-transmitted to anyone other than the intended recipient. If it has been received in error please notify the sender immediately and permanently delete the email.
Sign In or Register to comment.