Saving COUNTs?


Closed Thread
Results 1 to 11 of 11

Thread: Saving COUNTs?

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Yes, sorry. The last program displays 15, which is W1-60. But it does not become 30,45,60,75, etc.

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Try this code

    Code:
    count PORTC.5, 1000, W1
    X1 = X1+(W1 - 60)
    lcdout $fe,1, dec W1
    lcdout $fe,$c0, dec X1
    pause 10
    goto Main
    Al.
    All progress began with an idea

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Arrati-
    Thank you for your help. Although it looks good, your program does strange things! With no input on RC.5(LOW), X1 is all over the place, 126,76,20,216, etc., while W1 remains zero.

  4. #4


    Did you find this post helpful? Yes | No

    Default

    Adding the IF statement fixed it, and all is good! Thank you, Arrati.

    Main:

    count PORTC.5, 1000, W1
    if W1 > 60 then
    X1 = X1+(w1-60)
    endif
    lcdout $fe,1, dec W1
    lcdout $fe,$c0, dec X1
    pause 10
    goto Main

Similar Threads

  1. ADC Max Impendance and Power saving
    By Michael Wakileh in forum Schematics
    Replies: 3
    Last Post: - 28th June 2009, 19:29
  2. 16F to 18F context saving differences
    By brittons in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 1st April 2007, 03:40
  3. FYI Daylight Saving Time in the U.S.
    By ccsparky in forum General
    Replies: 1
    Last Post: - 7th November 2005, 15:05
  4. Problem with saving to EEPROM...
    By Tear in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 1st July 2005, 00:10
  5. I think my interrupt is not saving context properly?
    By royly in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th December 2004, 17:21

Members who have read this thread : 0

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