Society of Robots - Robot Forum

Software => Software => Topic started by: winnie66 on January 20, 2010, 09:51:36 AM

Title: using 16f 684 :how to program with assambly using count up to 7
Post by: winnie66 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
Title: Re: Need help---how to program with assambly using counte untill 6.
Post by: little-c on January 20, 2010, 05:40:12 PM
what are you trying to do?

http://ww1.microchip.com/downloads/en/devicedoc/41202D.pdf (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?

Title: Re: using 16f 684 :how to program with assambly using count up to 7
Post by: little-c 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.