enigma

AVR8 and uArt

3 posts in this topic

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

Share this post


Link to post
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;
  }
}

Share this post


Link to post
Share on other sites

Hi Jack,

Thanks, this is too cool!

Also I think you are doing a great job at not just helping them, but to get them to enjoy working with FPGAs! Keep up the excellent work, wish I could give a double thumbs up somehow!

Regards

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now