hi friends , I am using the HP-488-00-3 board, in my following program, i want to have delayed outputs at port B when my portA,1 is set and some outputs when the portA,1 is high, all other functions are fine, but my counter is not decrementing and give the output, i have attached my code, can any one point my mistake please
list p=16F84
radix hex
;It is a 16f84 xt oscillator, watchdog timer off, power-up timer on.
;include <p16f84.inc>
;__config _XT_OSC & _WDT_OFF & _PWRTE_ON
;----------------------------------------------------------------------
; cpu equates (memory map)
Status equ 0x03
portA equ 0x05 ; define the potA address
portB equ 0x06 ; (p. 10 defines port address)
Output_Status equ 0x08 ;
count1 equ 0xA0
count2 equ 0xA1
counter_status equ 0xA2
count3 equ 0xA3
count4 equ 0xA4
count5 equ 0xA5
count6 equ 0xA6
;----------------------------------------------------------------------
org 0x000
Initialise movlw 0X00
tris portB
movlw 0xFF
tris portA
;-----initialise PortB and Output_Status-------------
movlw 0x00
movwf portB
movwf counter_status
;-----------------------------------------------------
Start
;=========================================================================
;----------test bit-A0 if pressed invert B0--------------------
Test_Bit0
BTFSC portA,1
goto set_counter
BTFSS portA,0
goto clear_all
clear_all
BTFSC portA,1
goto set_counter
bcf portB,0
bcf portB,1
bcf portB,4
goto wait_0
set_counter
bsf portB,1
bcf portB,0
bcf portB,4
BTFSC counter_status,0
goto wait_0
movlw 0x01 ;--- to enable counter
movwf counter_status
movlw 0xFF
movwf count3
movlw 0x0A
movwf count4
movlw 0x00
movwf count5
movlw 0x00
movwf count6
goto wait_0
wait_0
;BTFSS portA,0
;goto Test_Bit1
;BTFSS portA,1
;goto Test_Bit1
;goto wait_0
Test_Bit1
BTFSS portA,0
goto clear_all
BTFSS portA,3
goto set_2
bsf portB,0
bsf portB,4
bsf portB,3
bcf portB,1
goto wait_1
set_2 bsf portB,0
bsf portB,4
bcf portB,3
bcf portB,1
goto wait_1
wait_1
;-------------5m Sec Delay------------------------
movlw 0xFF
movwf count1
movlw 0x0A ;here also can change the value for delay
movwf count2
Small_Delay
decfsz count1
goto Small_Delay
decfsz count2
goto Small_Delay
;----------------End of Delay----------------------
;-------------5m Sec Delay------------------------
BTFSS counter_status,0
goto Start
decfsz count3
goto Start
bsf portB,3
decfsz count4
goto Start
bsf portB,5
decfsz count5
goto Start
bsf portB,6
decfsz count6
goto Start
goto Start
end
counter is not functioning
For C and ASSEMBLY users to post questions and code snippets for programming in C and ASSEMBLY. And for any other C or ASM course related questions.
-
- Posts: 61
- Joined: Thu Dec 20, 2007 4:23 pm
- Location: singapore
Return to “C and ASM Programming”
Jump to
- Announcements
- ↳ Announcements
- The Knowledge Exchange
- ↳ Programming Tips & Tricks
- ↳ Freelance Embedded Engineers
- ↳ Article Discussion
- Microcontroller Programming
- ↳ General Programming
- ↳ Flowcode V9
- ↳ Flowcode V8
- ↳ Feature Requests
- ↳ Bug Reports
- ↳ User Components
- ↳ Flowcode V7
- ↳ User Components
- ↳ Feature requests
- ↳ Bug reports
- ↳ Fixed bugs
- ↳ 8-Bit PIC
- ↳ 16-Bit PIC
- ↳ 32-Bit PIC
- ↳ AVR & Arduino
- ↳ 32-Bit ARM
- ↳ Poll Discussion
- ↳ Flowcode V6
- ↳ Flowcode v6 Beta
- ↳ Bug reports
- ↳ Getting Started
- ↳ User Components
- ↳ Feature requests
- ↳ Bug reports
- ↳ Flowcode V5
- ↳ Flowcode V5 Issues
- ↳ Flowcode V5 Suggestions
- ↳ Flowcode V5 Free Edition
- ↳ Flowcode V4
- ↳ Flowcode 4 Bugs
- ↳ Flowcode 4 Suggestions
- ↳ Flowcode V2 & V3
- ↳ General / Misc
- ↳ Components (Comms)
- ↳ Components (Other)
- ↳ Bugs / Application Errors
- ↳ Suggestions
- ↳ BTEC Unit 6
- ↳ C and ASM Programming
- ↳ E-blocks
- ↳ Formula AllCode
- ↳ Formula Flowcode
- ↳ MIAC
- Language Support Forums
- ↳ Deutsch Support-Forum
- ↳ Forums d'aide en français
- ↳ Foro de soporte español
- Other Matrix products
- ↳ Electronics products
- ↳ Matrix Online Courses
- ↳ Other products
- ↳ CoCo
- Hidden