Shop OBEX P1 Docs P2 Docs Learn Events
Tach readout on 5 7-Segment Displays — Parallax Forums

Tach readout on 5 7-Segment Displays

msh5686msh5686 Posts: 70
edited 2012-02-17 08:34 in BASIC Stamp
I am working on a project that will use the feedback from a fan with a hall sensor to control the fan speed, then display the RPMs on a five 7-segment LEDs. To save space I am using SIPO shift registers to send the desired digits to each LED. The fan controller works fine and the debug display shows the correct RPMs. The LEDs work on their own (can have them count up and down, etc.), but my issue comes when I'm trying to join the two together. I save the Fan's speed under the variable RPMs and later in the code go to the following subroutine, called LEDs, to try and display this speed on the 5 7-segment displays.

LEDs:


HIGH Clear
SHIFTOUT Serial, Clock, 1, [RPMs]
PAUSE 100
RETURN

I get gibberish out on the LEDs from doing this. I know my issue is in getting the program to 'lookup' or convert the debugged value of RPMs to the corresponding digits I have specified as constants for the numbers 0 - 9 previously. I am somewhat new to this and would be grateful for any insight into how to get the LEDs to display the actual RPMs that are shown in the debug window. The rest of my program is attached if that will help. Thanks for the help.

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2012-02-16 11:00
    You're trying to shift out your RPMs variable.
    You have to parse the digits out of RPMs and then shift those out as segment data (re. Digit0, Digit1, etc.) as appropriate.
  • msh5686msh5686 Posts: 70
    edited 2012-02-17 07:14
    Thanks for the response PJ. Ok, I think I have an idea of what you are talking about with the shifting out as segmented data from reading some example programs. I'm not sure what you mean by parsing the digits out of the RPMs.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2012-02-17 08:34
    Say RPMs = 410
    Then you need to shift out a Digit4, a Digit1, and a Digit0
Sign In or Register to comment.