Hi
I need to generate the following pattern coding for two different ports(a and b). How do i assign the ports and first it has to generate on portA and with some delay then the next pattern to be generated.
Whatever pattern generated want to look back in the LCD on the PICDEMplus eval board- how i can do this.
LIST p=16F876A ;tell assembler what chip we are using
include "P16F876A.inc" ;include the defaults for the chip
;----------------------
#define CONF1 _CP_OFF & _DEBUG_OFF & _CPD_OFF
#define CONF2 _LVP_OFF & _BODEN_OFF & _PWRTE_ON & _WDT_OFF & _HS_OSC
__CONFIG CONF1 & CONF2
;---------------------
cblock 0x20 ;start of general purpose registers
pulsePolarity ;used to store previous pulse polarity
endc
;-------------------------
;Control line defs
GND equ b'00001010'
POS equ b'00001100'
NEG equ b'00000011'
;---------------------------
org 0x0000 ;org sets the origin, 0x0000 for the 16F876A
;-----------
;this is where the program starts running
movlw 0x07
movwf CMCON ;turn comparators off (make it like a 16F84)
bsf STATUS, RP0 ;select bank 1
movlw b'00000000' ;set PortB all outputs
movwf TRISA
bcf STATUS, RP0 ;select bank 0
main bcf pulsePolarity,0
theWork call pulse ; Positive Pulse
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendOne
call sendZero
call sendOne
call sendZero
call sendZero
call sendZero
call sendOne
call sendOne call sendZero
call sendZero
call sendZero
call sendZero
call sendOne
call sendOne
call sendZero
call sendOne
call sendZero
call sendZero
call sendZero
call sendOne
call sendOne
call sendOne
call sendOne
call sendZero
call sendZero
call sendZero
call sendOne
call sendZero
call sendZero
call sendZero
call sendZero
call sendOne
call sendZero
call sendZero
call sendOne call sendOne
call sendOne
call sendOne
call sendOne
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
goto theWork
; Idle for 1/10th clock period(10us) ------------------------------------------------
pulseWidthDelay
nop
nop
nop
nop
return
; Idle for one reference clock period(100us) --------------------------------------
groundDelay
call pulseWidthDelay
call pulseWidthDelay
call pulseWidthDelay
call pulseWidthDelay
call pulseWidthDelay
call pulseWidthDelay
call pulseWidthDelay
call pulseWidthDelay
call pulseWidthDelay
call pulseWidthDelay
call pulseWidthDelay
nop
nop
nop
nop
nop
nop
return
;-------------------------------------------------------
pulse
btfsc pulsePolarity,0
goto posPulse
negPulse bsf pulsePolarity,0
movlw NEG
goto pulseIt
posPulse bcf pulsePolarity,0
movlw POS
pulseIt movwf PORTA
call pulseWidthDelay
movlw GND
movwf PORTA
return
;---------------------------------------------------------
sendZero
call groundDelay
call groundDelay
call pulse
return
;----------------------------------------------------------
sendOne
call groundDelay
call pulse
call groundDelay
call pulse
return
;---------------------------------------------------------
sendSlash
call sendOne ; sending '/' - 1111001(Fh)
call sendOne
call sendOne
call sendOne
call sendZero
call sendZero
call sendOne
return
;--------------------------------------------------------
end
I need to generate the following pattern coding for two different ports(a and b). How do i assign the ports and first it has to generate on portA and with some delay then the next pattern to be generated.
Whatever pattern generated want to look back in the LCD on the PICDEMplus eval board- how i can do this.
LIST p=16F876A ;tell assembler what chip we are using
include "P16F876A.inc" ;include the defaults for the chip
;----------------------
#define CONF1 _CP_OFF & _DEBUG_OFF & _CPD_OFF
#define CONF2 _LVP_OFF & _BODEN_OFF & _PWRTE_ON & _WDT_OFF & _HS_OSC
__CONFIG CONF1 & CONF2
;---------------------
cblock 0x20 ;start of general purpose registers
pulsePolarity ;used to store previous pulse polarity
endc
;-------------------------
;Control line defs
GND equ b'00001010'
POS equ b'00001100'
NEG equ b'00000011'
;---------------------------
org 0x0000 ;org sets the origin, 0x0000 for the 16F876A
;-----------
;this is where the program starts running
movlw 0x07
movwf CMCON ;turn comparators off (make it like a 16F84)
bsf STATUS, RP0 ;select bank 1
movlw b'00000000' ;set PortB all outputs
movwf TRISA
bcf STATUS, RP0 ;select bank 0
main bcf pulsePolarity,0
theWork call pulse ; Positive Pulse
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendOne
call sendZero
call sendOne
call sendZero
call sendZero
call sendZero
call sendOne
call sendOne call sendZero
call sendZero
call sendZero
call sendZero
call sendOne
call sendOne
call sendZero
call sendOne
call sendZero
call sendZero
call sendZero
call sendOne
call sendOne
call sendOne
call sendOne
call sendZero
call sendZero
call sendZero
call sendOne
call sendZero
call sendZero
call sendZero
call sendZero
call sendOne
call sendZero
call sendZero
call sendOne call sendOne
call sendOne
call sendOne
call sendOne
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
call sendZero
goto theWork
; Idle for 1/10th clock period(10us) ------------------------------------------------
pulseWidthDelay
nop
nop
nop
nop
return
; Idle for one reference clock period(100us) --------------------------------------
groundDelay
call pulseWidthDelay
call pulseWidthDelay
call pulseWidthDelay
call pulseWidthDelay
call pulseWidthDelay
call pulseWidthDelay
call pulseWidthDelay
call pulseWidthDelay
call pulseWidthDelay
call pulseWidthDelay
call pulseWidthDelay
nop
nop
nop
nop
nop
nop
return
;-------------------------------------------------------
pulse
btfsc pulsePolarity,0
goto posPulse
negPulse bsf pulsePolarity,0
movlw NEG
goto pulseIt
posPulse bcf pulsePolarity,0
movlw POS
pulseIt movwf PORTA
call pulseWidthDelay
movlw GND
movwf PORTA
return
;---------------------------------------------------------
sendZero
call groundDelay
call groundDelay
call pulse
return
;----------------------------------------------------------
sendOne
call groundDelay
call pulse
call groundDelay
call pulse
return
;---------------------------------------------------------
sendSlash
call sendOne ; sending '/' - 1111001(Fh)
call sendOne
call sendOne
call sendOne
call sendZero
call sendZero
call sendOne
return
;--------------------------------------------------------
end