It looks like you should have a comma:
PEEK CHSEL, CHSELVAR
It looks like you should have a comma:
PEEK CHSEL, CHSELVAR
I have a concern for you, in this bit of code
I think your intention is to set chselvar equal to the contents of address chsel. then in the next line you test to see if they are different. So if I am following this correctly, you will have to move the channel selector at the exact moment between the peek and the IF. May work better to set a var like chselvarold then on the next loop see if chselvar = chselvarold. if = then goto start, if not decode what to do.Code:LOOP PEEK CHSEL CHSELVAR If CHSEL > CHSELVAR Then UP Else PEEK CHSEL CHSELVAR IF CHSEL < CHSELVAR Then DOWN Else GOTO Start
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
What about if I don't recheck with Peek and do this instead;
CHLP:
PEEK CHSEL, CHSELVAR 'Look at the 4 input pins from the channel selector
If CHSEL > CHSELVAR Then UP 'if it's larger then run subroutine UP
IF CHSEL < CHSELVAR Then DOWN 'if it's smaller then run subroutine DOWN
GOTO Start 'if neither are true then goto start
What do you think?
Got that working! Thanks for the tip,
Now on to the display. 3 digit 7 segment display, common cathode.
I want to take the port C pin states and look those up in a table.
Then Send the table contents at that address to the 3 digit display.
I've been reading post and looking at some lookup codes but to be honest, I don't know where to start.
I think I know what I want in the table but getting it to the display is where I'm getting confused.
Any suggestions?
Rayl113, I assume the display is going to be multiplexed as all you are using is port c? Is it going to have latches for the digit data or is it going to be some kind of serial display?
Dave Purola,
N8NTA
EN82fn
The display is laid out like this;
RB0=A
RB1=B
RB2=C
RB3=D
RB4=E
RC0=F
RC1=G
RC2=dp
RC3=Digit-1
RC4=Digit-2
RC5=Digit-3
RC6=Digit-4(future)
RC7=Digit-5(future)
I'm using NPN transistors to switch the digit commons to ground.
It would probably be a good idea to latch in the display data but I'm not sure how to proceed.
It's mostly learn by trial and error at this point.
Rayl113, I have attached an old program that you can use parts of or simply as a template to understand the workings of a multiplexed display using a pic. I hope this helps. I found an old hallway clock from a school and backward engineered the circuit. I just had to as the clock has 5 inch 7 segment digits. It used a pic processor so, I redesigned the software to accomodate the already designed circuit. Works Great....
Dave Purola,
N8NTA
EN82fn
Thanks. I think I got that part figured out;
Display:
'Segment A = PORTB.0
'Segment B = PORTB.1
'Segment C = PORTB.2
'Segment D = PORTB.3
'Segment E = PORTB.4
'Segment F = PORTC.0
'Segment G = PORTC.1
'Segment dp = PORTC.2
'Digit1 = PORTC.3
'Digit2 = PORTC.4
'Digit3 = PORTC.5
Where I'm stuck is building the tables and selecting the information to send to each digit. I have a spreadsheet with the values already calculated.
I want to sample PORTD and use that as the address of the info I want to send to the digits.
e.g., If PORTB = $3F, I want to use Address $3F as a pointer within the table and pull the info from that location and send it to the digits. Let's say "C19".
I need "C" in digit 1, "1" in digit 2, and "9" in digit 3.
This is where I'm stuck. The manual is really lacking when it comes to creating Lookup tables. I've looked at some of the example files, but gotten more confused.
So any help on this would be appreciated.
Bookmarks