In SX Microcontrollers, SX/B Compiler and SX-Key Tool, robotworkshop wrote: Hmm. When I look as the assembly code it shows that the INTERRUPT starts generating code at ORG $000 and all the remaining code, SUB, and FUNC are after that. I still need to write the main portion and do a lot of cleanup work but want to get the initial program to compile and assemble before moving on. Anyway, any suggestions are appreicated! ' ========================================================================= ' ' 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 ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=164958#m165002 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)