| Electronics > Beginners |
| Atmega8 PD and PC ports |
| (1/3) > >> |
| Lux_:
Hello everyone, I follow this forum for a while now but i haven't opened a topic yet, until now. I am a Student studying mechatronica and for a embedded design project i need to design a circuit, so I decided to make something with a atmega8 smd micro controller. I have made multiple projects with arduino's so i am a bit familiar with electronics and code. but i have a problem with a Atmega8 micro controller, let me explain. The micro controller is soldered on a adapter board and then put on a breadboard for testing. I program the micro controller with a Arduino IDE with the Arduino as ISP function. I have made a little program that read 8 thermistors trough a multiplexer(4051) and turn some leds on and off. (the leds don't connect to the multiplexer) I had everything working until i decided to add another led on the PC5 port and coded so that the led turns on and off with a delay of 1 second. But surprisingly another led which is connected to the PD5 port started blinking but the led on port PC5 didn't. When i changed the led on port PC5 to port PC4 and made the change in de code the led didn't blink but another led on PD4 did. I have looked in the Atmega8 datasheet but i am not able to find anything but I am no expert on reading datasheets. So please can someone help me with my problem. Is there a setting or are the ports in someway connected to each other? It is a project for school but i fear i started on something to big with a SMD micro controller. Thanks in advance, Lux_ |
| wraper:
It has nothing to do with MCU/datasheet. It should be something about Arduino library. In any case you can work with port directly, avoiding unnecessary code blob. https://www.arduino.cc/en/Reference/PortManipulation |
| Lux_:
Thanks for your reaction, I work with the port directly. this is a striped down version of my code which i also uploaded an still the same: --- Code: ---void setup() { // put your setup code here, to run once: pinMode(PC4, OUTPUT); } void loop() { // put your main code here, to run repeatedly: digitalWrite(PC4, HIGH); delay(1000); digitalWrite(PC4, LOW); delay(1000); } --- End code --- PD4 still blinks but PC4 doesn't |
| wraper:
--- Quote ---I work with the port directly. --- End quote --- Nope, you don't. You use bloated digitalwrite junk. IO would open library and look if there is any bug in it regarding port C. |
| Lux_:
--- Quote ---Nope, you don't. You use bloated digitalwrite junk. IO would open library and look id there is any bug in it regarding port C. --- End quote --- Okay I thought you meant PD5 instead of just 5. But how would you write it? maybe these are newbie questions but i am still learning :) I am glad that you took the time to read my post. |
| Navigation |
| Message Index |
| Next page |