![]() | ||
| Home | SwiftX Archive | SwiftForth Archive | |

I converting a major project to use IIC serial EEPROM (Microchip 24LC128
with a HC12A256) rather than NVRAM, and I am tripping over the DOES>
construction that worked well with the NVRAM. The code supports 100
methods, and each method has 28 programmable parameters. I have the
code working to read and write to the serial EEPROM, but I am puzzled
how to incorporate it into the Interpreter definition QPARAM, shown
below in its NVRAM incarnation, that works, and the EEPROM version which
probably has bugs, but I can't get past the error message:
Address 026A is not valid for this section type 0 384 QPARAM FV
"First Vial"
I cannot figure out what the compiler thinks is at address 026A.
This message appears whenever the compiler sees any of the definitions
included in my EEPROM.F code, such as EEStart!, SendWord, etc.
I am about ready to boot the elegance, and hard code all these
variables, but if someone wants to quote on tackling this I'm open to
paying for the help.
Thanks,
David Graham
Graham Automation, Inc.
623 582-2867
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++
Not working EEPROM version
100 EQU NumQMeth \ number of methods
CREATE Prompt$ 20 ALLOT
CREATE MinV 2 ALLOT
CREATE MaxV 2 ALLOT
CREATE LimAdd 2 ALLOT
INTERPRETER
: delay 0 ?Do loop ;
include eeprom.f
: QPARAM ( n1 n2 -- )
\ store min, max, data array, string byte count, description string at
address returned when def is executed
CREATE
EEAddress @ DUP ,
DUP EEStart!
SWAP SendWord SWAP SendWord EEStop
4 + NumQMeth CELLS +
BEGIN ACK? UNTIL
DUP EEStart!
[CHAR] " WORD DROP \ Skip to start of
description
[CHAR] " WORD COUNT
DUP SendByte ROT + \ Compile count byte
1+ EEAddress !
0 DO
COUNT drop \ SendByte \
LOOP
DROP EEStop \ Compile description string
DOES> ( n -- add ) \ Run-time behavior,
return address of variable, n is desired index
DUP LimAdd ! \ ( n add -
DUP EEStart@
ReadWord MaxV ! \ ( n add -
ReadWord MinV ! \ Store limits
EEStop
\ ( n add -
NumQMeth CELLS + DUP EEStart@ \ ( n add -
ReadByte Prompt$ 2DUP ! \ ( n add count
PromptAdd -
1+ SWAP 0 DO \ ( n add PromptAdd
ReadByte OVER C! 1+
LOOP DROP EEStop \ ( n add - Save
pointer to description string
@ SWAP CELLS + \
( paradd - address of nth parameter
;
========================================================================
================================
Working NVRAM version
100 EQU NumQMeth \ number of methods
CREATE Prompt$ 2 ALLOT
CREATE MinV 2 ALLOT
CREATE MaxV 2 ALLOT
CREATE LimAdd 2 ALLOT
INTERPRETER
: QPARAM ( n1 n2 -- )
\ store min, max, data array, string byte count, description string at
address returned when def is executed
CREATE , , UDATA NumQMeth CELLS RESERVE IDATA , \ Define
parameter
[CHAR] " WORD DROP \ Skip to start of description
[CHAR] " WORD COUNT DUP C, \ Compile count byte
0 DO COUNT
C, LOOP DROP ALIGN \ Compile description string
DOES> ( n -- add ) \ Run-time behavior, return
address of variable, n is desired index
\ add is address for parameter n
DUP LimAdd !
DUP 2@ \ ( n add max min -
MaxV ! MinV ! \ Store limits ( n add -
CELL+ CELL+ DUP CELL+ Prompt$ ! \ ( n add - Save pointer to
description string
@ SWAP CELLS + \ ( paradd - address of
nth parameter
;
TARGET
\ Min Max Variable Screen Text Index#
28 words/batch
0 384 QPARAM FV "First Vial" \ 0
... Plus another 27 parameters
-- Binary/unsupported file stripped by Ecartis --
-- Type: application/octet-stream
-- File: eeprom.f
----------------------------------------------------------------------
swiftx_at_forth.com The SwiftX programming discussion email list
To unsubscribe, send subject "unsubscribe" to swiftx-request_at_forth.com
For list command help, send subject "help" to swiftx-request_at_forth.com
Message archives are located at http://www.forth.com/archive/swiftx
----------------------------------------------------------------------
This list is a forum for SwiftX users. For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Fri Jan 02 2004 - 21:07:27 PST
This archive was generated by hypermail 2.2.0 : Fri Dec 05 2008 - 03:04:22 PST