T
treez
Guest
Hello,
Please advise on why this MPASM code for PIC18F65K22 won't build.
The assembler in MPLABX gives errors which I do not understand. It doesn't seem to recognise that i have used the ";" to indicate comments.
Here is the code...
Please advise on why this MPASM code for PIC18F65K22 won't build.
The assembler in MPLABX gives errors which I do not understand. It doesn't seem to recognise that i have used the ";" to indicate comments.
Here is the code...
Code ASM - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 ;ACTIVE HIGH IS ASSUMED THROUGHOUT ;TURN OFF ALL PULLUPS ;WHERE IS THE RESET ADDRESS? list p=18f65k22 ;list directive to define processor #include <p18f65k22.inc> ;processor specific definitions ; config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BODEN_OFF & _CPD_OFF) temp1 equ h'20 ;register for setting ch 1 temperature temp2 equ h'21 ;register for setting ch 2 temperature temp3 equ h'22 ;register for holding ch 3 temperature tempb equ h'23 ;register for holding board temperature dip8 equ h'24 ;holds dipswitch settings ana_8bit equ h'25 ;holds ADC reading converted to 8 bit from 12 bit ana_hi equ h'26 ;holds the ADRESH register ana_lo equ h'27 ;holds the ADRESL register ext_in equ h'28 ;holds the external connector inputs ; *** DECLARE MACRO'S *** ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ;**** bank switching **** ;*** TURN LEDS ON AND OFF ON1 macro ;Turn on chan1 bsf PORTE,RE1 endm OFF1 macro ;Turn off chan1 bcf PORTE,RE1 endm ON2 macro ;Turn on chan2 bsf PORTE,RE0 endm OFF2 macro ;Turn off chan2 bcf PORTE,RE0 endm ON3 macro ;Turn on chan2 bsf PORTG,RG0 endm OFF3 macro ;Turn off chan2 bcf PORTG,RG0 endm ;****** READ TEMP ****************** ; ************************ ; ******** Read dipswitchs into dip8 register ******** read_dips macro bsf dip8,0 ;DIPSWITCH 1 = MODE btfss PORTB,RB0 bcf dip8,0 bsf dip8,1 ;DIPSWITCH 2, Power bit 0 btfss PORTB,RB1 bcf dip8,1 bsf dip8,2 ;DIPSWITCH 3, power bit 1 btfss PORTB,RB2 bcf dip8,2 bsf dip8,3 ;DIPSWITCH 4, polarity of 0-10V btfss PORTB,RB3 bcf dip8,3 bsf dip8,4 ;DIPSWITCH 5, Temp threshold = 80c or 90c btfss PORTB,RB4 bcf dip8,4 bsf dip8,5 ;DIPSWITCH 6, unused btfss PORTB,RB5 bcf dip8,5 bsf dip8,6 ;DIPSWITCH 7, unused btfss PORTC,RC5 bcf dip8,6 bsf dip8,7 ;DIPSWITCH 8, fan or no fan btfss PORTE,RE6 bcf dip8,7 endm ;----------------------------------------------- ;****** READ EXTERNAL CONNECTOR DIGITAL INPUTS ******* read_ext_conn macro bsf ext_in,0 ;extconn PIN 1, UNUSED btfss PORTD,RD4 bcf ext_in,0 bsf ext_in,1 ;extconn PIN 3; RESET btfss PORTD,RD5 bcf ext_in,1 bsf ext_in,2 ;extconn PIN 4; CH1_ON/OFF btfss PORTD,RD6 bcf ext_in,2 bsf ext_in,3 ;extconn PIN 5; CH2_ON/OFF btfss PORTD,RD7 bcf ext_in,3 bsf ext_in,4 ;extconn PIN 6; CH3_ON/OFF btfss PORTC,RC7 bcf ext_in,4 bsf ext_in,5 ;extconn PIN 7; UNUSED btfss PORTC,RC6 bcf ext_in,5 bsf ext_in,6 ;extconn PIN 8; UNUSED btfss PORTC,RC0 bcf ext_in,6 bsf ext_in,7 ;extconn PIN 10; CLEAR btfss PORTC,RC1 bcf ext_in,7 endm ; ***************************************** ; **** output a tripped signal **** output_trip macro bsf PORTA, RA4 endm ; *****output a non-tripped signal **** no_output_trip macro bcf PORTA, RA4 endm ;***** Make ADC reading 8 bit from 12 bit *********** ana_to_8bit macro movf ADRESH,w movwf ana_8bit endm ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ;SET UP THE ADC setupADC macro movlw h'00 movwf ADCON0 ;channel select, godone, ADON movlw h'10 movwf ADCON1 ;vref movlw h'3E movwf ADCON2 ;Right justified, acquisition time endm ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx org 04 start nop goto start end
Last edited by a moderator: