Error assembling after successfully compiling SX/B code....
![RobotWorkshop](https://forums.parallax.com/uploads/userpics/915/nCTRZ4MIBWKDB.jpg)
I've written a few demo programs in SX/B with good results. I am working
on a new one with the SX28 that will take parallel data on Port C, do some
conversion on the data, then send it out serially to another device. I setup
an Interrupt to catgh the strobe signal on pin RB.7 which should ensure I
can get the data at port C at the right time.
The current program gets through the SX/B compiler fine and generates the
.SRC file. The problem that come up as that the assembly fails when it hits
the interrupt code. The error that shows up is:
Error 30, Pass 2: Overwriting same program counter location.
Any idea what would cause this and what may fix it?
on a new one with the SX28 that will take parallel data on Port C, do some
conversion on the data, then send it out serially to another device. I setup
an Interrupt to catgh the strobe signal on pin RB.7 which should ensure I
can get the data at port C at the right time.
The current program gets through the SX/B compiler fine and generates the
.SRC file. The problem that come up as that the assembly fails when it hits
the interrupt code. The error that shows up is:
Error 30, Pass 2: Overwriting same program counter location.
Any idea what would cause this and what may fix it?
Comments
If you post your SX/B code I can arrange it so it will assemble properly.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1
"USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
' =========================================================================
'
' File...... PARTOSER.SXB
' Purpose... Get Parallel byte, convert, send to Serial device
' Author.... Robert L Doerr
' E-mail.... rdoerr@bizserve.com
' Website... http://www.robotworkshop.com
' Created... 03 JAN 2007
' Updated... 12 JAN 2007
'
' =========================================================================
'
' Program Description
'
'
'
' Device Settings
'
DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
FREQ 4_000_000
ID "PARTOSER"
PROGRAM Start
'
' IO Pins
'
SSer VAR RA.0 ' Serial output
SBusy VAR RA.3 ' Serial device busy (input)
SIO VAR TRIS_A ' I/O direction of Port A
PSTB VAR RB.7 ' Parallel latch signal (low to high transition) (input generates interrupt)
PBusy VAR RB.6 ' Signal to host (low=busy, high=ok for more) (output)
CIO VAR TRIS_B ' I/O direction of Port B (Control port)
Pdata VAR RC ' Parallel data (input)
PIO VAR TRIS_C ' I/O direction of Port C
'
' Constants
'
Yes CON 0 ' active low input
No CON 1
Baud CON "OT9600" ' Baud rate for Serial device
'
' Variables
'
pCode VAR Byte ' Parallel data
newCode VAR Byte ' Is there a new byte? (Flag)
tmpB1 VAR Byte ' subroutine work vars
tmpB2 VAR Byte
'
INTERRUPT
'
ISR_Start:
pCode = Pdata ' Get parallel byte from Port C
LOW PBusy ' Tell Host that byte received
newCode = Yes ' Set the flag for new byte
GOTO ISR_Exit
ISR_Exit:
WKPND_B = %00000000 ' Clear the interrupt flag
RETURNINT
'
' Function and Subroutine Declarations
'
Conv_Code FUNC 1, 1 ' lookup and convert byte
TX_Byte SUB 1 ' TX to Serial I/O
'
' Program Code
'
Start:
SIO = %00001110 ' Set RA.0 as output for Serial data
CIO = %10111111 ' Setup Control port
PIO = %11111111 ' Setup Parallel input port
WKPND_B = %00000000 ' Clear any pending interrupts
WKED_B = %00000000 ' Rising edge detect
WKEN_B = %01111111 ' Only accept RB.7 as interrupt source
newCode = No
Main:
' Check newCode for byte received
' If newCode = Yes then
' check to see if Serial device ready
' If so, translate byte, send to Serial device, and clear flag
'
GOTO Main
'
' Subroutine Code
'
'
' Use: Conv_Code
' -- '
Conv_Code:
tmpB1 = __PARAM1 ' save byte value
read ConvTable+tmpB1,tmpB2
RETURN tmpB2
'
' Use: TX_Byte char
' -- 'Transmits 'char' over serial connection
TX_Byte:
tmpB1 = __PARAM1 ' get the passed byte value
SEROUT SSer, Baud, tmpB1 ' Send the byte
RETURN
' =========================================================================
' User Data
' =========================================================================
ConvTable:
DATA 1
DATA 3
DATA 5
DATA 5
DATA 9
DATA 18
DATA 14
DATA 14
DATA 12
DATA 155
DATA 129
DATA 129
DATA 10
DATA 142
DATA 172
DATA 166
DATA 1
DATA 3
DATA 5
DATA 5
DATA 9
DATA 18
DATA 14
DATA 14
DATA 12
DATA 155
DATA 129
DATA 129
DATA 10
DATA 142
DATA 172
DATA 166
DATA 1
DATA 3
DATA 5
DATA 5
DATA 9
DATA 18
DATA 14
DATA 14
DATA 12
DATA 155
DATA 129
DATA 129
DATA 10
DATA 142
DATA 172
DATA 166
DATA 1
DATA 3
DATA 5
DATA 5
DATA 9
DATA 18
DATA 14
DATA 14
DATA 12
DATA 155
DATA 129
DATA 129
DATA 10
DATA 142
DATA 172
DATA 166
DATA 1
DATA 3
DATA 5
DATA 5
DATA 9
DATA 18
DATA 14
DATA 14
DATA 12
DATA 155
DATA 129
DATA 129
DATA 10
DATA 142
DATA 172
DATA 166
DATA 1
DATA 3
DATA 5
DATA 5
DATA 9
DATA 18
DATA 14
DATA 14
DATA 12
DATA 155
DATA 129
DATA 129
DATA 10
DATA 142
DATA 172
DATA 166
DATA 1
DATA 3
DATA 5
DATA 5
DATA 9
DATA 18
DATA 14
DATA 14
DATA 12
DATA 155
DATA 129
DATA 129
DATA 10
DATA 142
DATA 172
DATA 166
DATA 1
DATA 3
DATA 5
DATA 5
DATA 9
DATA 18
DATA 14
DATA 14
DATA 12
DATA 155
DATA 129
DATA 129
DATA 10
DATA 142
DATA 172
DATA 166
The PROGRAM command generates the startup code (even with the NOSTARTUP parameter, there is still a bit of startup code needed).
Another suggestion is that SEROUT will not be reliable with the internal 4MHz clock. It's just not stable enough.
The next version of the compiler actually gives a warning if you use SEROUT or SERIN with the internal clock.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1
"USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
now all the code compiles fine. What was throwing me off was that org $000 at the beginning
of the INTERRUPT code....
Now I can start adding the rest of the code and clean it up. I'll try an external resonator
on the board. The whole thing is wired up on one of the SX48 protoboards and I may get
to try this out tonight.
Best Regards,
Robert