CH340 USB to TTL Serial Adaptor Then Connecting Max232 Then Connecting ATMEG Chi
ID: 3874359 • Letter: C
Question
CH340 USB to TTL Serial Adaptor
Then Connecting Max232
Then Connecting ATMEG Chip 328P
I am able to send the singnal but I am unable to upload my program code to the chip by using the above serial communication device! Help me to sort out the problem
Folowing are the codes!
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT); } void loop() {
// put your main code here, to run repeatedly:
int val = Serial.read() - '0' ;
if (val == 1)
{ Serial.println ("on");
digitalWrite (13, HIGH);
}
else if (val == 0)
{
Serial.println("OFF");
digitalWrite(13, LOW);
}
if (val == 2)
{
Serial.println ("on");
digitalWrite (12, HIGH);
}
else if (val == 3)
{
Serial.println("OFF");
digitalWrite(12, LOW);
}
if (val == 4)
{
Serial.println ("on");
digitalWrite (11, HIGH);
}
else if (val == 5)
{
Serial.println("OFF");
digitalWrite(11, LOW);
}
while (Serial.available() == 0 );
Serial.println(val);
}
Explanation / Answer
Here the problem described is unable to upload program to the Chip
Make sure the following are done properly
If you are still facing the problem then comment with proper screenshots of the error and little more specific
HOPE THIS HELPS
FEEL FREE TO COMMENT