Newbie question!!!


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2006
    Posts
    60

    Default Newbie question!!!

    I have a program that I'm trying to make work but am having problems. This program is supposed to count how many times pin 0 goes low. I'm using a 4026 chip and here's the code. . . . . . I'm trying to see how many times a wheel goes around. I'm using a QRB1134 sensor. Any help would be greatly appreciated!!!!!

    '************************************************* ***************
    '* Name : WHEEL COUNTER *
    '* Author : [select VIEW...EDITOR OPTIONS] *
    '* Notice : Copyright (c) 2007 [select VIEW...EDITOR OPTIONS] *
    '* : All Rights Reserved *
    '* Date : 6/16/2007 *
    '* Version : 1.0 *
    '* Notes : *
    '* : *
    '************************************************* ***************
    symbol sensor=pin0
    symbol counter=5
    symbol reset=4
    symbol CMCON=$19
    symbol ANSEL=$9F
    symbol TRISIO=$85

    Main:
    poke CMCON,$07 'shut off comparators
    poke ANSEL,$00 'set to all digital
    poke TRISIO,$01 'set GPIO 0 as input & GPIO 1,2,3,4,5 as output
    pulsout 4,10 'reset display
    B1=0 'reset counter
    B3=0
    Loop:
    if sensor=0 then Count1
    goto Loop

    Count1:
    B3=B3+1
    if B3=2 then Clock
    goto Loop

    Clock:
    pulsout 4,10 'reset display to 0
    B1=B1+1
    if B1>1 then Count 'counter
    pulsout 5,10 'ditto
    B3=0
    return
    Count:
    B1=B1+1 'increment count by 1
    for B2=1 to B1 'count to display
    pulsout 5,10 'ditto
    next B2 'ditto
    B3=0
    goto Loop 'return to main program

  2. #2
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    maybe part of the problem - you have a "return" in your code but no "gosub"
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

Similar Threads

  1. Newbie 74hc595 question
    By manjero in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 22nd January 2008, 22:22
  2. newbie with serial com question...
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 16th December 2006, 05:34
  3. Newbie Question - Info Please
    By ehoskins in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 2nd October 2006, 14:50
  4. Greetings from Newbie and a question
    By ChrisHelvey in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 24th July 2006, 15:52
  5. Newbie question
    By senojlr in forum General
    Replies: 7
    Last Post: - 11th April 2006, 21:23

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts