AVR8 and uArt


enigma

Recommended Posts

Hi,

I just started using the AVR8 and found it very fun to play with.

I would like to know how can I make the AVR8 just output the value of what is received by the uArt?

Detail : I would like to have the AVR8 to accept input, form say putty, then output this ASCII output, 8 bits, to pins on the Papilio board.

Reason : It will be fun to see as I type in putty how my connected LEDs to my 8 pins flicker in binary as I type in the Putty terminal.

I know this should be easy, but I have no idea how to do this, is there standard AVR8 library , functions... to do this?

Regards

Link to comment
Share on other sites

Hey, this sounds like a fun thing to do. :)

The AVR8 and Arduino library should make it real easy to do.

Take a look at the page about reading from the serial port at arduino.cc.

All we need to do is modify their sample code so that instead of outputting on the serial port we output to a physical port.

We can start with this


int incomingByte = 0; // for incoming serial data

void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}

void loop() {

// send data only when you receive data:
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();

// say what you got:
Serial.print("I received: ");
Serial.println(incomingByte, DEC);
}
}

And change it to this:


int incomingByte = 0;  // for incoming serial data

void setup() {
  Serial.begin(9600);  // opens serial port, sets data rate to 9600 bps
}

void loop() {

  // send data only when you receive data:
  if (Serial.available() > 0) {
      // read the incoming byte:
      incomingByte = Serial.read();

      // say what you got:
      Serial.print("I received: ");
      Serial.println(incomingByte, DEC);
      porta = incomingByte;
  }
}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.