Reading and storing pulses from 8 bit port


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2009
    Posts
    10

    Default Reading and storing pulses from 8 bit port

    Hi Group,

    My plan is to read incoming pulses on the 8 input lines of a port, store/totalize in a long variable and transmitted when requested.
    The pulses are generated by 8 electricity meters, issuing 1000 pulses per kWh. (1 meter per port input)
    In order to read a maximum of 10 kWh the pulses from each meter will appear at approx 2.5 seconds interval.
    The possibility do exist that pulses from 2 or 3 meters will arrive simultaneously.
    To overcome the problem of simultaneous pulses I thought of using interrupts but I am not sure if interrupts can be done on 8 input pins.
    Also the operation of reading/totalizing/storing of the pulse data should not be affected by the montly request for down load.

    Unfortunately I do not have a try-ed program to attach as I am still trying to figure out what to do.

    Has any-one perhaps got some info or a suggestion other than PicBasicPro for this type of operation.
    Any support will be appreciated.

    Thank you all in advance

  2. #2
    Join Date
    Feb 2009
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: Reading and storing pulses from 8 bit port

    Hi group,

    Just after I have submitted a question on PicBasicPro I saw the message from Sticky.
    I am sorry if my post went to the wrong section.
    Can moderator fix the placing?

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,518


    Did you find this post helpful? Yes | No

    Default Re: Reading and storing pulses from 8 bit port

    I'm pretty sure there are PICs with a full 8-bit port worth of IOC capable pins and some devices lets you set it up so it only triggers on rising or falling (and not both).

    But since this is still a fairly low frequency input I guess you could just poll the port, periodically (like 10 times per second) and XOR the port with the result from the previous poll. Any bits set in the result have changed. Increment your 8 counters based on state of each bit. This has the drawback of incrementing the counter twice for each pulse but there are ways around that too of course.

    /Henrik.

  4. #4
    Join Date
    Feb 2009
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: Reading and storing pulses from 8 bit port

    Henrik,

    Thank you for the prompt info.
    I will have a look at the Pics available and try experimenting.

    /Danie

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,588


    Did you find this post helpful? Yes | No

    Default Re: Reading and storing pulses from 8 bit port

    Look for IOC feature. I remember seeing PICs that would monitor all of port B for a change.

    PIC18(L)F2X/4XK22:

    RBIE: Port B Interrupt-On-Change (IOCx) Interrupt Enable bit
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  6. #6
    Join Date
    Feb 2009
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: Reading and storing pulses from 8 bit port

    Thanks Demon. I will do a search

Similar Threads

  1. Newbie question on reading port staus
    By SOTASOTA in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 8th December 2012, 22:25
  2. Index a bit through a portion of a port
    By ecoli-557 in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 12th March 2012, 23:22
  3. Reading Input on Port B
    By bodgetts in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 31st July 2011, 02:01
  4. Reading the port - Little help needed
    By Megahertz in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 26th June 2011, 20:15
  5. storing arrays and reading arrays
    By Yue in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 5th March 2004, 23:03

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