|
|
View previous topic :: View next topic |
Author |
Message |
acidice333
Joined: 14 Oct 2006 Posts: 33
|
7 segment on port A |
Posted: Fri Oct 01, 2010 2:11 am |
|
|
I'm trying to hookup a 7segment to port A on my 18f2550 (port B is used, I need the internal pull ups on that port).
I stumbled upon the EX_LED example but what do I change in LED_MAP for it to work properly?
My pin configuration. The original code had a pin for the decimal but I don't need it.
Thanks
Code: |
BYTE CONST LED_MAP[10] = {0x90,0xb7,0x19,0x15,0x36,0x54,0x50,0xb5,0,0x24};
//// LED seg f Pin A0
//// LED seg a Pin A1
//// LED seg e Pin A2
//// LED seg c Pin A3
//// LED seg d Pin A4
//// LED seg b Pin A5
|
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19551
|
|
Posted: Fri Oct 01, 2010 6:41 am |
|
|
LED_MAP, is the bit patterns to use _in a particular port_, to output the required pattern of LED's. You need to change the lines in the code that output this pattern to the port, not the patterns (except for the DP).
You are only showing 'six segment' wiring. You need seg g as well...
The problem is that the example, outputs an entire byte (using all eight bits), to give seven segments plus DP, then uses two more bits for the digit selects.
Changing the patterns, won't stop the code outputting the whole port...
How many digits are you using?.
Where is segment g, and what are the digit selects connected to?.
Best Wishes |
|
|
acidice333
Joined: 14 Oct 2006 Posts: 33
|
|
Posted: Fri Oct 01, 2010 1:41 pm |
|
|
Oh sorry I was up late last night.
seg G is connected to A6, and there is only 1 digit so I don't need to worry about another digit. I ended up just turning each pin on/off in order to make the proper digit but I was hoping to use something like that example instead of a bunch of output_highs and lows.
The original example had pins B0 to B7, but I'm using the 18f2550 with port A but it only has A0 to A6 so I had to rid the DP pin (plus I dont need it) so that shifted the pinouts. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|