Author Topic: using 16f 684 :how to program with assambly using count up to 7  (Read 1101 times)

0 Members and 1 Guest are viewing this topic.

Offline winnie66Topic starter

  • Beginner
  • *
  • Posts: 3
  • Helpful? 0
using 16f 684 :how to program with assambly using count up to 7
« on: January 20, 2010, 09:51:36 AM »
I am struggling to use counter.  My project is using pic16f684, assembly language.

my program  which counted from 0 up to 7 , anybody can check for me? When I run this, feel like something wrong when the count is '011'.

clrf count

again

btfss count,2
    goto B20
    goto B21

B20
    btfss count,1
    goto B20B10
    goto B20B11

B20B11
    btfss count,0
    goto B20B11B00                 ;010
    goto B20B11B01                ;011

B20B10    
    btfss count,0                
    goto B20B10B00                   ;000
    goto B20B10B01                   ;001

B21
    btfss count,1
    goto B21B10
    goto B21B11

B21B10
    btfss count,0
    goto B21B10B00              ;100
    goto B21B10B01                   ;101
 
B21B11
    btfss count,0
    goto B21B11B00                 ;110
    goto B21B11B01                ;111

 B21B10B00
---
goto label

B21B10B01
--
goto label
----




label
    movlw 1
    addwf count,1 
    goto again

thanks
« Last Edit: January 23, 2010, 08:35:03 AM by winnie66 »

Offline little-c

  • Robot Overlord
  • ****
  • Posts: 186
  • Helpful? 1
Re: Need help---how to program with assambly using counte untill 6.
« Reply #1 on: January 20, 2010, 05:40:12 PM »
what are you trying to do?

http://ww1.microchip.com/downloads/en/devicedoc/41202D.pdf
table 13.2
holds instructions you need to be able to do stuff.

btfsc  "Bit Test f, Skip if Clear"  <<<<<< whats that doing? are you shure that code counts till three?


Offline little-c

  • Robot Overlord
  • ****
  • Posts: 186
  • Helpful? 1
Re: using 16f 684 :how to program with assambly using count up to 7
« Reply #2 on: January 23, 2010, 08:56:49 AM »
 :o what is this actuly doing? I can't tell and don't feel like trying to find out. blame lazyness.

 


Get Your Ad Here

data_list