Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

serial communication between ATmega128 and Spartan 3E

Status
Not open for further replies.

arash rezaee

Member level 5
Joined
Sep 10, 2009
Messages
87
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,952
Hi every one.

I want to send 5 digit number from Atmega128 to FPGA(Spartan 3E). Let say for example I want to send 19999 into FPGA and then use it for my project. What is the best way for this communication?

Regards
Arash
 

How far apart are the devices? What speed do you need? Personally, I would use a simple serial link. If you've got a lot of extra pins, you could do it parallel.
 

Hi again.

Well I decided to use SPI between Atmega and Spartan. But I have little problem. I have a number like 19999 and I want to convert it to hex and then send it via SPI. How can I convert it?

Regards
Arash
 

You don't have to convert it before transmitting. The following will all store the same value in i ("0x" denotes hex, "0b" denotes binary):

int i;
i = 16;
i = 0x10;
i = 0b10000;
 

Why do you need to convert to hex? You can convert each character to ASCII if you want, but that will require more bytes. If you know your maximum number size (for example 19999) you can just send it as a 4-byte message-you don't have to convert.
 
  • Like
Reactions: alexxx

    alexxx

    Points: 2
    Helpful Answer Positive Rating
barry said:
Why do you need to convert to hex? You can convert each character to ASCII if you want, but that will require more bytes. If you know your maximum number size (for example 19999) you can just send it as a 4-byte message-you don't have to convert.
+1.

Or if you know for example that the number is always smaller than 65535 (0xFFFF), then you could split it in two bytes and send each byte in separate.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top