![]() | ![]() | ![]() |
| |||||||
| Electronic Projects Design/Ideas/Reviews Are you building an electronic project or want to? Maybe you need some assistance? Come and submit your electronic questions here and let our experienced members find a solution. |
![]() |
| | Tools |
| | #16 |
|
I should mention that we can take advantage of the column driver bus (only 1 pin is ever low at one time) to implement a simple single-pin column driven switch matrix, if you don't mind a few 1N4148 diodes, where you sample each switch once every six or seven interrupts (depends on how many display columns you're scanning). If you're using 1.0-msec interrupts this provides a very crude 6 or 7 msec 'debounce' and the code is incredibly simple (the SWKEYS variable is "live" switch press data); Code: ;
; refresh switch input from column driven switch matrix (one
; switch tested each interrupt cycle)
;
; COLPOS is our column position ring counter which will contain one
; of the following values; 00000001, 00000010, 00000100, 00001000, etc.
;
; comf COLPOS,W ; example ~COL3 = 11110111 |
andwf SWKEYS,f ; indicate switch 'off' (0)
movf COLPOS,W ; example COL3 = 00001000
btfss SWInput ; is switch at COLPOS 'on' (0)?
iorwf SWKEYS,f ; yes, indicate 'on' (1)
Last edited by Mike, K8LH; 8th May 2007 at 02:58 PM. | |
| |
| | #17 | |
| Quote:
Last edited by Mike, K8LH; 8th May 2007 at 02:43 PM. | ||
| |
| | #18 | |
| Quote:
I agree with you that the 25mA port limits would be ok for a small multiplexed 7-segment display. But as the OP wants to make his own very large display, I assume he will need many leds per segment, and I don't favour his 5v supply requirement. I would be happier if the drivers were able to handle about 500mA, at least it would help protect the chips during the software development stage if he had any multiplexing errors etc. | ||
| |
| | #19 |
|
Thank Mike, K8LH and others. Mike, K8LH as u suggest... Picture has been modified.. Now i am going to use "74HC138". ![]() Now i need ur help. First little detail. I am going to use 12 volts for driving Large 7 Segment Display. For boosting the current after IC 4511 i am going to use "ULN2003".. some thing like this: PIC I/O---> IC 4511 ----> ULN2003 -----> Big7 Segment display. But the problem is, what i use after 74HC138 for boosting the current for driving the Big 7 Segment. I mean: PIC I/O---> IC 74HC138 ----> ?????? -----> Big7 Segment display. Hope u can understand. Thanks in advance. | |
| |
| | #20 |
|
Now the complete Circuit.. ![]() I want to know from senior membors which will be the best choice for P-Channel MOSFETs for this knid of application. C & C are welcome. Thanks in advance.. | |
| |
| | #21 | |
| Quote:
Last edited by Mike, K8LH; 10th May 2007 at 12:16 AM. | ||
| |
| | #22 | |
| Quote:
Have fun. Mike | ||
| |
| | #23 |
|
Where is GRAMO. GRAMO are u going to show basic code for the above project?? Thanks | |
| |
| | #24 |
|
lol, I won't write the whole thing, but surely a push in the right direction will help. Personally, I would prefer to use 7 I/O's for the segment's, instead of adding the 4511. Now you have one less component, and the whole project is still very doable with a single 28 Pin PIC. From there, you need 'Shadow Registers' that contain the Hour/Minute/Second data. Multiplexing each buffer quickly would ensure the displays would not appear to flicker. The following was written with Swordfish, and the wiring diagram is just a piccy from my site, so you could use the same analogy, but with a different circuit; Note: This code displays how to use the ISRTimer library. Two timers are set up. One to increment a variable, the other to multiplex the displays Code: Device = 18F452
Clock = 20
#option _Segment_Port = PORTC // Define the 7-Segment PORT
#option _Segment_TRIS = GetTRIS(_Segment_Port) // Nice way to automatically get the TRIS
// automatically from a selected port
Include "ISRTimer.bas"
Include "utils.bas"
Dim Segment_1_TRIS As TRISD.1, // User must define what pins control
Segment_2_TRIS As TRISD.0, // each segment
Segment_1 As PORTD.1,
Segment_2 As PORTD.0
Dim Number As Byte, // Program variables that require no
Segment_Data As _Segment_Port, // user settings
Segment_TRIS As _Segment_TRIS,
Segment_1_Data As Byte,
Segment_2_Data As Byte
Const
Timer1 = 0,
Timer2 = 1
// Update_Segments event, multiplex the segment data...
Sub Update_Segments()
If Segment_1 = 1 Then
Segment_1 = 0
Segment_Data = Segment_2_Data
Segment_2 = 1
Else
Segment_2 = 0
Segment_Data = Segment_1_Data
Segment_1 = 1
EndIf
End Sub
Function Segment_Encode(Segment_Byte As Byte) As Byte // Convert a byte into segment information
Select Segment_Byte
Case 0
Result = %00111111
Case 1
Result = %00000110
Case 2
Result = %01011011
Case 3
Result = %01001111
Case 4
Result = %01100110
Case 5
Result = %01101101
Case 6
Result = %01111100
Case 7
Result = %00000111
Case 8
Result = %01111111
Case 9
Result = %01100111
EndSelect
End Function
Sub EncodeSegmentData() // Encodes segment data
Segment_1_Data = Digit(Number,1) // Extract the first digit & convert it
Segment_1_Data = Segment_Encode(Segment_1_Data)
Segment_2_Data = Digit(Number,2) // Extract the second digit & convert it
Segment_2_Data = Segment_Encode(Segment_2_Data)
End Sub
// Increment_Number event will increment the register Number
Sub Increment_Number()
Inc(Number)
If Number = 100 Then
Number = 0
EndIf
EncodeSegmentData
End Sub
// Start Of Program...
Timer.Initialize(2) // initialize the timer module...
// initialise each timer
Timer.Items(Timer1).Interval = 5 // 5ms
Timer.Items(Timer1).OnTimer = @Update_Segments // timer1 event handler
Timer.Items(Timer2).Interval = 500 // 500ms
Timer.Items(Timer2).OnTimer = @Increment_Number // timer2 event handler
Number = 0 // Initialize variables
EncodeSegmentData
Segment_TRIS = %00000000 // Make the segment data lines outputs
Low(Segment_1_TRIS)
Low(Segment_2_TRIS)
Timer.Items(Timer1).Enabled = True // enable the timers...
Timer.Items(Timer2).Enabled = True
Timer.Start // start processing all timers...
// main program loop...
While True
Wend
__________________ digital-diy.com - Hobby microcontroller projects and tutorials. Assembly, PICBasic and C examples. | |
| |
| | #25 |
|
Driving segments directly from I/O pins is fine for a few displays but the I/O pins just can't meet the peak current demands when you lower the duty cycle with 4 or more displays. I'm pretty good at analyzing code but I'm lost with that example. Why not just use a 1-msec interrupt to "scan" the display and update the Clock variables once per second (once per 1000 interrupts)? I'm pretty proud of my High Performance PWM display design -- a single IC and six or seven transistors, and you don't need a 28 pin PIC Last edited by Mike, K8LH; 11th May 2007 at 02:11 AM. | |
| |
| | #26 | |
| Quote:
The multiplexing is done every 5mS, this could be lowered too 1mS if you want, just a matter of changing this line; Code: Timer.Items(Timer1).Interval = 1 // 1ms Timer.Items(Timer1).OnTimer = @Update_Segments // timer1 event handler Code: // Update_Segments event, multiplex the segment data...
Sub Update_Segments()
If Segment_1 = 1 Then
Segment_1 = 0
Segment_Data = Segment_2_Data
Segment_2 = 1
Else
Segment_2 = 0
Segment_Data = Segment_1_Data
Segment_1 = 1
EndIf
End Sub
Code: Inc(Current_Display) //
If Current_Display = 6 Then Current_Display = 0 // Roll over to first display if required
Select Current_Display // Find out what data to display
Case 0
// Display Seconds_0
Case 1
// Display Seconds_1
Case 2
// Display Minutes_0
Case 3
// Display Minutes_1
Case 4
// Display Hours_0
Case 5
// Display Hours_1
EndSelect
__________________ digital-diy.com - Hobby microcontroller projects and tutorials. Assembly, PICBasic and C examples. Last edited by gramo; 11th May 2007 at 05:18 AM. | ||
| |
| | #27 | |
| Quote:
If you multiplex 8 displays you'll have a 12.5% duty cycle. The 20-ma or so peak current that an I/O pin can supply to an individual LED will have an "average" current of 2.5-ma and your display will be much dimmer. Last edited by Mike, K8LH; 11th May 2007 at 08:25 AM. | ||
| |
| | #28 |
|
I am making Main Board in Eagle. But there is a problem ![]() How to connect +5 Volts and ground to IC2(4028) and IC1(4511). (I will make it's PCB in Eagle) Thanks | |
| |
| | #29 |
|
My project is approx 80% completed. Power Supply And it's PCB. ![]() ![]() Display Board And it's PCB ![]() ![]() Main Board(Pcb under construction) ![]() I am enjoying this Project. I am writing it's code in MikroBasic. Code is approx completed but not tested yet... Soon i will post the Whole Project here. Thanks. | |
| |
| | #30 |
|
Just a pointer: You can open the pictures in Paint and use the "Stretch/Skew" feature to make them smaller Why not use Logic FET's? That way you could drive them without the transistor/resistors in place, saving 18 components!
__________________ digital-diy.com - Hobby microcontroller projects and tutorials. Assembly, PICBasic and C examples. | |
| |
|
| Tags |
| clockbig, digital, pic |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| ULTRA clean 9VDC Power Supply Project | Peter_wadley | Electronic Projects | 51 | 13th May 2009 07:58 AM |
| PIC Digital Clock | muralibhat | Micro Controllers | 36 | 26th October 2008 12:46 AM |
| The Oscilloscope | ElectroMaster | Electronic Theory | 12 | 3rd February 2008 02:45 PM |
| Digital Troubleshooting and testing | walters | General Electronics Chat | 38 | 24th August 2005 09:21 AM |
| Newcomers, please read! (PIC regarded) Upd. 0xD | Jay.slovak | Micro Controllers | 0 | 17th April 2005 02:05 PM |