;; Node test ;; ;; The purpose of this program is to verify that nodes ;; can interconnect I/O pins. include "processor.inc" include ; Grab some useful macros CONFIG OSC = HSPLL, OSCS = ON, WDT = ON, LVP = OFF CONFIG CP0 = ON, CP1 = ON, CPB = ON include "ssd0323.inc" include "osram128x64.inc" include "portdef.inc" ;------------------------------------------------------------------------ ; gpsim command .command macro x .direct "C", x endm ;---------------------------------------------------------------------- ; Variable declarations ;---------------------------------------------------------------------- GPR_DATA UDATA_ACS temp RES 1 temp0 RES 1 temp1 RES 1 temp2 RES 1 temp3 RES 1 GLOBAL temp0, temp1, temp2, temp3 Tx RES 1 Ty RES 1 DISPLAY_DATA UDATA 400 DisplayBuffer RES LCD_nROWS*LCD_nCOLS/8 GLOBAL DisplayBuffer ;------------------------------------------------------------------------ ; Code labels GLOBAL done ;---------------------------------------------------------------------- ; ********************* RESET VECTOR LOCATION ******************** ;---------------------------------------------------------------------- RESET_VECTOR CODE 0x000 ; processor reset vector bra start ; go to beginning of program ;---------------------------------------------------------------------- ; ******************* INTERRUPT VECTOR LOCATION ****************** ;---------------------------------------------------------------------- INT_VECTOR CODE 0x008 ; interrupt vector location RETFIE 1 ;---------------------------------------------------------------------- ; ******************* MAIN CODE START LOCATION ****************** ;---------------------------------------------------------------------- MAIN CODE start ;; ;; Define the simulation environment. ;; .sim "module library libgpsim_extras" .sim "module library libgpsim_modules" .sim "module load OSRAM128X64 LCD" .sim "module load pullup R1" .sim "module load pullup R2" if InterfaceMode == Mode8080 .sim "module load pullup RBS1" .sim "module load pullup RBS2" endif if InterfaceMode == Mode6800 .sim "module load pulldown RBS1" .sim "module load pullup RBS2" endif if InterfaceMode == ModeSPI .sim "module load pulldown RBS1" .sim "module load pulldown RBS2" endif .sim "node nBS1" .sim "node nBS2" .sim "attach nBS2 RBS2.pin LCD.bs2" .sim "attach nBS1 RBS1.pin LCD.bs1" if InterfaceMode == Mode6800 || InterfaceMode == Mode8080 .sim "node nE" .sim "node nRW" .sim "attach nE porte0 LCD.e" .sim "attach nRW porte1 LCD.rw" .sim "node nd0 nd1 nd2 nd3 nd4 nd5 nd6 nd7" .sim "attach nd0 portb0 LCD.d0" .sim "attach nd1 portb1 LCD.d1" .sim "attach nd2 portb2 LCD.d2" .sim "attach nd3 portb3 LCD.d3" .sim "attach nd4 portb4 LCD.d4" .sim "attach nd5 portb5 LCD.d5" .sim "attach nd6 portb6 LCD.d6" .sim "attach nd7 portb7 LCD.d7" else .sim "module load pulldown Rgnd" .sim "node nGnd" .sim "attach nGnd Rgnd.pin LCD.d7 LCD.d6 LCD.d5 LCD.d4 LCD.d3 LCD.d2 LCD.e LCD.rw" .sim "node nSDA nSCL" .sim "attach nSDA portc5 LCD.d1" .sim "attach nSCL portc3 LCD.d0" endif .sim "node nCS" .sim "node nRES" .sim "node nDC" .sim "attach nDC porte2 LCD.dc" .sim "attach nCS portd0 LCD.cs R2.pin" .sim "attach nRES portd1 LCD.res" ;; Now position the modules in the BreadBoard viewer .sim "LCD.xpos=220.0" .sim "LCD.ypos=24.0" .sim "R1.xpos=216.0" .sim "R1.ypos=264.0" .sim "R2.xpos=312.0" .sim "R2.ypos=264.0" ; .sim "R3.xpos=376.0" ; .sim "R3.ypos=264.0" if InterfaceMode == ModeSPI ;; Initialize the SPI port: ;CKP == 1 ;CKE == 0 BCF TRISC, RC5 BCF TRISC, RC3 CLRF SSPSTAT SPIClk_FOSC_64 EQU (1<