This part of the code is where I have narrowed it down to.
- Code: Select all
unpackdata
TBLRD*+ ;read table byte, advance to next
movf TABLAT,W ;get the table byte
bz Newpointer
movwf TXREG ;save it in TXREG
call sentdatapack ;make sure TXIF is set
goto unpackdata ;send next byte
sentdatapack
btfss PIR1, TXIF ;has the byte been sent
goto sentdatapack ;no, do it again
return ;yes, finished.
Newpointer
This section runs all the time.
- Code: Select all
Hyper_Tlink_1;Program Mode
movlw b'10000000';
movwf PORTB
goto Hyper_Tlink_1
The total Program as is at the moment below.
- Code: Select all
list p=18f452
#include p18f452.inc
;18F452 Configuration Registers
config OSC = HS ;crystal osc pll (4x10 = 40MHz)
config OSCS = OFF ;oscillator switch enable is off
config PWRT = ON ;power up timer on
config BOR = OFF ;brown-out reset off
config BORV = 45 ;brown out voltage 4.5 volts
config WDT = OFF ;watchdog timer
config WDTPS = 1 ;watchdog timer postscaler
config CCP2MUX = OFF ;disable (RB3)
config STVR = OFF ;stack overflow reset disabled
config LVP = OFF ;low voltage programming disabled
config DEBUG = OFF ;background debugger off
config CP0 = OFF ;code protection block 0
config CP1 = OFF
config CP2 = OFF
config CP3 = OFF
config CPB = OFF ;code protection boot block
config CPD = OFF ;code protection data EEPROM
config WRT0 = OFF ;write protection block 0
config WRT1 = OFF
config WRT2 = OFF
config WRT3 = OFF
config WRTB = OFF ;write protection boot block
config WRTC = OFF ;write protection configuration register
config WRTD = OFF ;write protection data EEPROM
config EBTR0 = OFF ;table read protection block 0
config EBTR1 = OFF
config EBTR2 = OFF
config EBTR3 = OFF
config EBTRB = OFF ;table read protection boot block
udata
string_index res 1
string_data res 1
string_pointer res 1
delay res 1
miner res 1
offset res 1
track_num res 1
track_con res 1
track_string res 1
temp res 1
counter res 1
code
movlw b'00010000';Used for?
movwf TRISA
movlw b'00000000'
movwf PORTA
movlw b'00000001';Used for?
movwf TRISB
movlw b'00000000';
movwf PORTB
movlw b'00000000';
movwf TRISC
movlw b'00000000';
movwf PORTC
movlw b'00000000';
movwf TRISD
movlw b'00000000';
movwf PORTD
movlw b'00000000';
movwf TRISE
movlw b'00000000';
movwf PORTE
movlw B'01000001' ;Fosc/8, A/D enabled
movwf ADCON0
movlw B'00001110' ;Left justify,1 analog channel
movwf ADCON1 ;VDD and VSS references
;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
;
reciever
;ASYNCHRONOUS MODE (NRZ) will be stop if entering sleep mode
;BRGH = 1
;20 MHz
;SPBRG = 129 or H'81'
bcf TRISC,6 ;Make RC6 an output
movlw 0x81 ;9600 baud @20MHz
movwf SPBRG
bsf TXSTA,TXEN ;Enable transmit
bsf TXSTA,BRGH ;Select high baud rate
bsf RCSTA,SPEN ;Enable Serial Port
bsf RCSTA,CREN ;Enable continuous reception
bcf PIR1,RCIF ;Clear RCIF Interrupt Flag
bsf PIE1,RCIE ;Set RCIE Interrupt Enable
bcf INTCON,PEIE ;Enable peripheral interrupts
bcf INTCON,GIE ;Enable global interrupts
goto test_receive
test_receive
btfss PIR1,RCIF ;
goto test_receive
movf RCREG,w ;
call request ;
request
;Program Mode
xorlw "A" ;
btfsc STATUS,Z ;
goto set1
;Entry Mode
xorlw "A"
xorlw "B"
btfsc STATUS,Z
goto set2
;Program Test
xorlw "B"
xorlw "C"
btfsc STATUS,Z
goto set3
;Adjust Settings
xorlw "C"
xorlw "D"
btfsc STATUS,Z
goto set4
;Stop
xorlw "D"
xorlw "E"
btfsc STATUS,Z
goto set5
;Testing Program
xorlw "E"
xorlw "F"
btfsc STATUS,Z
goto set6
;Program 1
xorlw "F"
xorlw "G"
btfsc STATUS,Z
goto set7
;Program 2
xorlw "G"
xorlw "H"
btfsc STATUS,Z
goto set8
;Data Mode 1
xorlw "H"
xorlw "I"
btfsc STATUS,Z
goto set9
;Data Mode 2
xorlw "I"
xorlw "J"
btfsc STATUS,Z
goto set10
;Resume Running
xorlw "J"
xorlw "K"
btfsc STATUS,Z
goto set11
;Quit Program
xorlw "K"
xorlw "L"
btfsc STATUS,Z
goto set12
;Cancel
xorlw "L"
xorlw "M"
btfsc STATUS,Z
goto set13
;User 1 Settings
xorlw "M"
xorlw "N"
btfsc STATUS,Z
goto set14
;User 2 Settings
xorlw "N"
xorlw "O"
btfsc STATUS,Z
goto set15
;User 3 Settings
xorlw "O"
xorlw "P"
btfsc STATUS,Z
goto set16
;Save Project
xorlw "P"
xorlw "Q"
btfsc STATUS,Z
goto set17
;Debugging
xorlw "Q"
xorlw "R"
btfsc STATUS,Z
goto set18
;Write to EEprom
xorlw "R"
xorlw "S"
btfsc STATUS,Z
goto set19
;Start Up
xorlw "S"
xorlw "T"
btfsc STATUS,Z
goto set20
;YES or NO
xorlw "T" ;
xorlw "U" ;
btfsc STATUS,Z ;
goto set21
; ;Continue ?
xorlw "U"
xorlw "V"
btfsc STATUS,Z
goto set22
;Add New Field
xorlw "V"
xorlw "W"
btfsc STATUS,Z
goto set23
;Try it again
xorlw "W"
xorlw "X"
btfsc STATUS,Z
goto set24
;Change Data to
xorlw "X"
xorlw "Y"
btfsc STATUS,Z
goto set25
;Send
xorlw "Y"
xorlw "Z"
btfsc STATUS,Z
goto set26
;Recieve
xorlw "Z"
xorlw "a"
btfsc STATUS,Z
goto set27
;Save
xorlw "a"
xorlw "b"
btfsc STATUS,Z
goto set28
;Copy
xorlw "b"
xorlw "c"
btfsc STATUS,Z
goto set29
;EXIT
xorlw "c"
xorlw "d"
btfsc STATUS,Z
goto set30
;Start Running
xorlw "d"
xorlw "e"
btfsc STATUS,Z
goto set31
;Servo No 1
xorlw "e"
xorlw "f"
btfsc STATUS,Z
goto set32
;Servo No 2
xorlw "f"
xorlw "g"
btfsc STATUS,Z
goto set33
;Servo No 3
xorlw "g"
xorlw "h"
btfsc STATUS,Z
goto set34
;Servo No 4
xorlw "h"
xorlw "i"
btfsc STATUS,Z
goto set35
;Run All Servo's
xorlw "i"
xorlw "j"
btfsc STATUS,Z
goto set36
;Select a Different?
xorlw "j"
xorlw "k"
btfsc STATUS,Z
goto set37
;Profile
xorlw "k"
xorlw "l"
btfsc STATUS,Z
goto set38
;Event
xorlw "l"
xorlw "m"
btfsc STATUS,Z
goto set39
;To Program
xorlw "m"
xorlw "n"
btfsc STATUS,Z
goto set40
return
;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
PM data " Program Mode \r\0";1 $
EM data " Entry Mode \r\0";2 $
PT data " Program Test \r\0";3 $
AS data "Adjust Settings\r\0";4 $
ST data " STOP \r\0";5 $
TP data "Testing Program\r\0";6 $
P1 data " Program 1 \r\0";7 $
P2 data " Program 2 \r\0";8 $
DM1 data " Data Mode 1 \r\0";9 $
DM2 data " Data Mode 2 \r\0";10 $
RR data " Resume Running\r\0";11 $
QP data " Quit Program \r\0";12 $
CXL data " Cancel \r\0";13 $
U1S data "User 1 Settings\r\0";14 $
U2S data "User 2 Settings\r\0";15 $
U3S data "User 3 Settings\r\0";16 $
SP data " Save Project?\r\0";17 $
DEBUG data " Debugging \r\0";18 $
EEP data "Write to EEprom\r\0";19 $
SU data " Start Up \r\0";20 $
;*********************************************************
;
;***********************************************************
YS data " YES or NO \r\0";21 $
CC data " Continue ? \r\0";22 $
NF data " Add New Field \r\0";23 $
TA data " Try it again \r\0";24 $
CDATA data " Change Data to\r\0";25 $
SED data " Send \r\0";26 $
R1 data " Recieve \r\0";27 $
S2 data " Save \r\0";28 $
CW data " Copy \r\0";29 $
EXIT data " EXIT \r\0";30 $
SRR data " Start Running \r\0";31 $
SV1 data " Servo No 1 \r\0";32 $
SV2 data " Servo No 2 \r\0";33 $
SV3 data " Servo No 3 \r\0";34 $
SV4 data " Servo No 4 \r\0";35 $
RASV data " Run All Servo's\r\0";36 $
SDD data " Select a Different?\r\0";37$
PPG data " Profile \r\0";38 $
EEV data " Event \r\0";39 $
PU data " To Program \r\0";40 $
;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
set1
movlw upper (PM)
movwf TBLPTRU
movlw high (PM)
movwf TBLPTRH
movlw low (PM)
movwf TBLPTRL
call unpackdata
goto Hyper_Tlink_1
set2
movlw upper (EM)
movwf TBLPTRU
movlw high (EM)
movwf TBLPTRH
movlw low (EM)
movwf TBLPTRL
call unpackdata
goto Hyper_Tlink_2
set3
movlw upper (PT)
movwf TBLPTRU
movlw high (PT)
movwf TBLPTRH
movlw low (PT)
movwf TBLPTRL
call unpackdata
goto Hyper_Tlink_3
set4
movlw upper (AS)
movwf TBLPTRU
movlw high (AS)
movwf TBLPTRH
movlw low (AS)
movwf TBLPTRL
call unpackdata
goto Hyper_Tlink_4
set5
movlw upper (ST) ;
movwf TBLPTRU
movlw high (ST)
movwf TBLPTRH
movlw low (ST)
movwf TBLPTRL
call unpackdata
goto Hyper_Tlink_5
set6
movlw upper (TP) ;
movwf TBLPTRU
movlw high (TP)
movwf TBLPTRH
movlw low (TP)
movwf TBLPTRL
call unpackdata
goto Hyper_Tlink_6
set7
movlw upper (P1) ;
movwf TBLPTRU
movlw high (P1)
movwf TBLPTRH
movlw low (P1)
movwf TBLPTRL
call unpackdata
goto Hyper_Tlink_7
set8
movlw upper (P2) ;
movwf TBLPTRU
movlw high (P2)
movwf TBLPTRH
movlw low (P2)
movwf TBLPTRL
call unpackdata
goto Hyper_Tlink_8
set9
movlw upper (DM1) ;
movwf TBLPTRU
movlw high (DM1)
movwf TBLPTRH
movlw low (DM1)
movwf TBLPTRL
call unpackdata
goto Hyper_Tlink_9
set10
movlw upper (DM2) ;
movwf TBLPTRU
movlw high (DM2)
movwf TBLPTRH
movlw low (DM2)
movwf TBLPTRL
call unpackdata
goto Hyper_Tlink_10
set11
movlw upper (RR) ;
movwf TBLPTRU
movlw high (RR)
movwf TBLPTRH
movlw low (RR)
movwf TBLPTRL
call unpackdata
goto Hyper_Tlink_11
set12
movlw upper (QP) ;
movwf TBLPTRU
movlw high (QP)
movwf TBLPTRH
movlw low (QP)
movwf TBLPTRL
call unpackdata
goto Hyper_Tlink_12
set13
movlw upper (CXL) ;
movwf TBLPTRU
movlw high (CXL)
movwf TBLPTRH
movlw low (CXL)
movwf TBLPTRL
call unpackdata
goto Hyper_Tlink_13
set14
movlw upper (U1S) ;
movwf TBLPTRU
movlw high (U1S)
movwf TBLPTRH
movlw low (U1S)
movwf TBLPTRL
call unpackdata
goto Hyper_Tlink_14
set15
movlw upper (U2S) ;
movwf TBLPTRU
movlw high (U2S)
movwf TBLPTRH
movlw low (U2S)
movwf TBLPTRL
call unpackdata
goto Hyper_Tlink_15
set16
movlw upper (U3S) ;
movwf TBLPTRU
movlw high (U3S)
movwf TBLPTRH
movlw low (U3S)
movwf TBLPTRL
call unpackdata
goto Hyper_Tlink_16
set17
movlw upper (SP) ;
movwf TBLPTRU
movlw high (SP)
movwf TBLPTRH
movlw low (SP)
movwf TBLPTRL
call unpackdata
goto Hyper_Tlink_17
set18
movlw upper (DEBUG) ;
movwf TBLPTRU
movlw high (DEBUG)
movwf TBLPTRH
movlw low (DEBUG)
movwf TBLPTRL
call unpackdata
goto Hyper_Tlink_18
set19
movlw upper (EEP) ;
movwf TBLPTRU
movlw high (EEP)
movwf TBLPTRH
movlw low (EEP)
movwf TBLPTRL
call unpackdata
goto Hyper_Tlink_19
set20
movlw upper (SU) ;
movwf TBLPTRU
movlw high (SU)
movwf TBLPTRH
movlw low (SU)
movwf TBLPTRL
call unpackdata
goto Hyper_Tlink_20
set21
movlw upper (YS)
movwf TBLPTRU
movlw high (YS)
movwf TBLPTRH
movlw low (YS)
movwf TBLPTRL
call unpackdata
goto Hyper__1
set22
movlw upper (CC)
movwf TBLPTRU
movlw high (CC)
movwf TBLPTRH
movlw low (CC)
movwf TBLPTRL
call unpackdata
goto Hyper__2
set23
movlw upper (NF)
movwf TBLPTRU
movlw high (NF)
movwf TBLPTRH
movlw low (NF)
movwf TBLPTRL
call unpackdata
goto Hyper__3
set24
movlw upper (TA)
movwf TBLPTRU
movlw high (TA)
movwf TBLPTRH
movlw low (TA)
movwf TBLPTRL
call unpackdata
goto Hyper__4
set25
movlw upper (CDATA) ;
movwf TBLPTRU
movlw high (CDATA)
movwf TBLPTRH
movlw low (CDATA)
movwf TBLPTRL
call unpackdata
goto Hyper__5
set26
movlw upper (SED) ;
movwf TBLPTRU
movlw high (SED)
movwf TBLPTRH
movlw low (SED)
movwf TBLPTRL
call unpackdata
goto Hyper__6
set27
movlw upper (R1) ;
movwf TBLPTRU
movlw high (R1)
movwf TBLPTRH
movlw low (R1)
movwf TBLPTRL
call unpackdata
goto Hyper__7
set28
movlw upper (S2) ;
movwf TBLPTRU
movlw high (S2)
movwf TBLPTRH
movlw low (S2)
movwf TBLPTRL
call unpackdata
goto Hyper__8
set29
movlw upper (CW) ;
movwf TBLPTRU
movlw high (CW)
movwf TBLPTRH
movlw low (CW)
movwf TBLPTRL
call unpackdata
goto Hyper__9
set30
movlw upper (EXIT) ;
movwf TBLPTRU
movlw high (EXIT)
movwf TBLPTRH
movlw low (EXIT)
movwf TBLPTRL
call unpackdata
goto Hyper__10
set31
movlw upper (SRR) ;
movwf TBLPTRU
movlw high (SRR)
movwf TBLPTRH
movlw low (SRR)
movwf TBLPTRL
call unpackdata
goto Hyper__11
set32
movlw upper (SV1) ;
movwf TBLPTRU
movlw high (SV1)
movwf TBLPTRH
movlw low (SV1)
movwf TBLPTRL
call unpackdata
goto Hyper__12
set33
movlw upper (SV2) ;
movwf TBLPTRU
movlw high (SV2)
movwf TBLPTRH
movlw low (SV2)
movwf TBLPTRL
call unpackdata
goto Hyper__13
set34
movlw upper (SV3) ;
movwf TBLPTRU
movlw high (SV3)
movwf TBLPTRH
movlw low (SV3)
movwf TBLPTRL
call unpackdata
goto Hyper__14
set35
movlw upper (SV4) ;
movwf TBLPTRU
movlw high (SV4)
movwf TBLPTRH
movlw low (SV4)
movwf TBLPTRL
call unpackdata
goto Hyper__15
set36
movlw upper (RASV) ;
movwf TBLPTRU
movlw high (RASV)
movwf TBLPTRH
movlw low (RASV)
movwf TBLPTRL
call unpackdata
goto Hyper__16
set37
movlw upper (SDD) ;
movwf TBLPTRU
movlw high (SDD)
movwf TBLPTRH
movlw low (SDD)
movwf TBLPTRL
call unpackdata
goto Hyper__17
set38
movlw upper (PPG) ;
movwf TBLPTRU
movlw high (PPG)
movwf TBLPTRH
movlw low (PPG)
movwf TBLPTRL
call unpackdata
goto Hyper__18
set39
movlw upper (EEV) ;
movwf TBLPTRU
movlw high (EEV)
movwf TBLPTRH
movlw low (EEV)
movwf TBLPTRL
call unpackdata
goto Hyper__19
set40
movlw upper (PU) ;
movwf TBLPTRU
movlw high (PU)
movwf TBLPTRH
movlw low (PU)
movwf TBLPTRL
call unpackdata
goto Hyper__20
return;
unpackdata
TBLRD*+ ;read table byte, advance to next
movf TABLAT,W ;get the table byte
bz Newpointer
movwf TXREG ;save it in TXREG
call sentdatapack ;make sure TXIF is set
goto unpackdata ;send next byte
sentdatapack
btfss PIR1, TXIF ;has the byte been sent
goto sentdatapack ;no, do it again
return ;yes, finished.
Newpointer
;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Hyper_Tlink_1;Program Mode
movlw b'10000000';
movwf PORTB
goto Hyper_Tlink_1
Hyper_Tlink_2;Entry Mode
movlw b'01000000';
movwf PORTB
goto Hyper_Tlink_2
Hyper_Tlink_3;
movlw b'00100000';
movwf PORTB
goto Hyper_Tlink_3
Hyper_Tlink_4;Adjusting setting
;banksel PORTB
movlw b'00010000';
movwf PORTB
goto Hyper_Tlink_4
Hyper_Tlink_5;
Hyper_Tlink_6;
Hyper_Tlink_7;
Hyper_Tlink_8;
Hyper_Tlink_9;
Hyper_Tlink_10;
Hyper_Tlink_11;
Hyper_Tlink_12;
Hyper_Tlink_13;
Hyper_Tlink_14;
Hyper_Tlink_15;
Hyper_Tlink_16;
Hyper_Tlink_17;
Hyper_Tlink_18;
Hyper_Tlink_19; EEprom write
Hyper_Tlink_20;
;0000000000000000000000000000000000000000000
Hyper__1
Hyper__2
Hyper__3
Hyper__4
Hyper__5
Hyper__6
Hyper__7
Hyper__8
Hyper__9
Hyper__10
Hyper__11
Hyper__12
Hyper__13
Hyper__14
Hyper__15
Hyper__16
Hyper__17
Hyper__18
Hyper__19
Hyper__20
end