View previous topic :: View next topic |
Author |
Message |
Paulvk
Joined: 28 Jul 2006 Posts: 1257 Location: SYDNEY
|
Posted: Thu Sep 22, 2011 5:28 am Post subject: GETING MORE DIGITAL OUTPUTS & INPUTS |
|
|
I know there are many times when you run out of pins for inputs and outputs then have to get a lareger device with more pins even though the flash is big enough well I find this so I thought I would design a set of boards that can use a serial buss to do this.
The first is a board that has 2 x 74HC595 serial to parrallel devices on it, there are a number of pin compatable devices like this that can be substituted that give high current outputs. It also has provision for 2 kingbright 7 segment displays and current limiting resistors. So with just 3 pins from the microcontroller, 5 wires > serial data, clock, latch, power and ground you can get 16 digital outputs.
Now as more inouts and outputs may be needed I am making the boards so they can be daisy chained to get more.
The boards are being designed in Kicad which is free to use and download so anybody can make them .
I will also attach the code to drive them.
I will also build a clock using 3 modules which gets its time from the internet via ntp.
Once I finish the boards I will have some made and will have a limited number in excess to my need so those who want these can have them for cost + post.
I hope this will help others who look at using a serial buss but do not know where to start.
This is the number to digit table
Code: |
Sub Segment
Select Case Num
Case 0 : Seg = 62976 '0 Shift , Seg , Right , 8 GIVES LEFT DIGIT '
Case 1 : Seg = 5120 '1
Case 2 : Seg = 47616 '2
Case 3 : Seg = 15872 '3
Case 4 : Seg = 23552 '4
Case 5 : Seg = 28160 '5
Case 6 : Seg = 60928 '6
Case 7 : Seg = 13312 '7
Case 8 : Seg = 65024 '8
Case 9 : Seg = 31744 '9
Case 10 : Seg = 64512 'A
Case 11 : Seg = 59392 'F
Case 12 : Seg = 57856 'C
Case 13 : Seg = 59904 'E
Case 14 : Seg = 58880 'G
Case 15 : Seg = 56320 'H
Case 16 : Seg = 1 'LEFT DEC POINT
Case 17 : Seg = 256 'RIGHT DEC POINT
Case 18 : Seg = 65535 'ALL OFF
Case 19 : Seg = 0 'ALL ON
End Select
|
|
|
Back to top |
|
|
Paulvk
Joined: 28 Jul 2006 Posts: 1257 Location: SYDNEY
|
Posted: Tue Oct 11, 2011 10:50 am Post subject: |
|
|
I now have a diagram for the clock. It is a six digit seven segment display and 2 x 16 LCD combined. It can display anything you want not just the time, the ADC inputs are there to be used, I have included a relay to switch things off and on, it has an RS232 port which can be connected to an RF board, also it has auto dimming function when it gets dark to not be so bright (I am using 0.8 inch 7 segment displays).
It shows that you can run a lot of things off a 28 pin mega AVR and still have some ports left.
Working on code to run it! |
|
Back to top |
|
|
Paulvk
Joined: 28 Jul 2006 Posts: 1257 Location: SYDNEY
|
Posted: Sat Jan 07, 2012 12:42 pm Post subject: |
|
|
Ok this is code that works with the clock to display the time sent to it via RS232 every second not finished yet as it will have a real time clock that will be updated by the web-sever I am working on.
Regards Paul |
|
Back to top |
|
|
Paulvk
Joined: 28 Jul 2006 Posts: 1257 Location: SYDNEY
|
Posted: Tue Jan 17, 2012 10:48 am Post subject: |
|
|
Another usefull device I have come accross for digital outputs is the TLC59025 it is a 16bit serial device similar to 74HC595 but it is designed to provide constant current drive to 16 LEDs it can sink up to 45ma and withstand up to 17volts at these ports it also has a single input dimmer function that sets the current at the ports via a resistor.
Regards Paul |
|
Back to top |
|
|
Paulvk
Joined: 28 Jul 2006 Posts: 1257 Location: SYDNEY
|
Posted: Thu Apr 05, 2012 1:37 pm Post subject: |
|
|
Now with the ENC28J60 server I have 16 digital outputs and 16 digital inputs using 4 pins so I have put together the code here that can be used to control/read these and all that needs to be changed is the pin numbers used in the 4 Alias commands to use this code in your own project. It is modular each step is contained in its own Sub.
Regards Paul |
|
Back to top |
|
|
|