Your code is using direct port addressing, and the Mega is different from the Uno in this respect as well.Īs you are a software person then you know that the code is very poorly written. If you could post all your code then we would be able to see.Įdit. The Meag has a different internal structure to the Uno in this respect. If it works in the Uno but not on the Mega then it is likely that the code uses timers and interrupts. When I change from the uno to the mega I use the exaact same pins on the mega that I used on the uno. That image is actually taken from the tutorial I am using but I did the exact same thing. It also cut off a part where I explain that I attached the connection diagram for my setup to the post. Not sure what happened but it cut off my code in the original post so I added that here. MuxValues=analogRead(0) // read the vlaue on that pin and store in array SetPin(i) // choose an input pin on the 74HC4067 Serial.println("Values from multiplexer:") dumps captured data from array to serial monitor 74HC4067 multiplexer demonstration (16 to 1)īyte muxValues = ĭDRD = B11110000 // set PORTD (digital ) to outputs 5V to 74HC4067 pin 1 to power the LEDs connect 74HC4067 S0~S3 to Arduino D7~D4 respectively see truth table on page 2 of TI 74HC4067 data sheet control pins output table in array form 74HC4067 demultiplexer demonstration (1 to 16) * Please improve upon it! Let me know how you've made it better. * License: CC-SA 3.0, feel free to use this code however you'd like. * you can to expand the I/O capabilities of your chosen microcontroller * Description: Instead of upgrading your microcontroller, with this board * A multiplexer of this sort really just acts as a 16 to one 1 switch Again this is just so I can get a working setup and then apply it to my own solution. Very basic, just lights each LED one at a time. I have searched very hard for an answer to my issues and I am beginning to think there may be some sort of HW difference between the uno and mega that I dont understand (Im a software engineer so HW is often mysterious to me.) I can tell you however that when I moved my setup from the uno to the mega that all connections were kept exactly the same so there should be no need to change the code as far as I am aware. However the problem I have is that my program works perfectly on the uno but when I switch to the mega the LEDs never light up. I have an uno so no big deal, I can go through the tutorial with the uno first and move to the mega. I can only find tutorials for other Arduinos, mostly the uno. I have been working off of examples on the internet on how to use the multiplexor, however I cannot find any tutorials on how to control LEDs with a demux on the Arduino Mega. Right now I just want to make a simple program that controls several different LEDs just as a beginner project so that I know how the demultiplexor works before I get into the more complicated solution I really need. I plan to use the 4067 as a demux to change the connection from 1 device to one of 16 devices at will. I have spent a lot of time trying to get my 74HC4067 to work with my Arduino Mega 2560 but I have been unable to find any answers so I am resorting to creating my own post in hopes I can solve my issues.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |