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.

Input from HyperTerminal to Microblaze using RS232

Status
Not open for further replies.

khamitkar.ravikant

Member level 4
Member level 4
Joined
Jul 15, 2008
Messages
78
Helped
6
Reputation
12
Reaction score
2
Trophy points
1,288
Location
India
Activity points
1,798
microblaze print

I am using EDK tools and Microblaze for implementing encryption algorithm
as i implemented code and that is working fine for input stored in side local memory of microblaze processor .
now i m looking for a procedure where input will be taken from rs232 terminal using
hyperterminal so i m looking out for help
regarding same
code snippet will be highly appreciated
thanks alot
 

hyperterminal garbage

Hi,
If you are using Xilinx kernel as a part of the software for Microblaze then the RS232 (UART) controller is avialable with the Board development kit and the code used to print using this interface is xil_printf.
The settings of the hyper terminal sdhould match the UART interface settings used in the EDK.
 
xilinx api for microblaze

thanks for reply
but ultimately i want the solution to a problem like i used "xil_printf" and even "print" functions but they are used to send data from microblaze to hyperterminal(PC) and i want hyperterminal(PC) to microblaze direction. that is anologus with "scanf" function of ANSI C.
so i hope now i m clear regarding my problem

thanks again.
 

how to use scanf to print onto hyperterminal

Oops...
What I know is you can send it if you use some Operating system on it, like petalinux (Embedded OS for microblaze).
The other info is that you can either paste to Host (Ctrl+V) or use the send file option.
I have no direct option to get the input from UART now.
stdin/stdout has to be linked to UART in the software and OS settings.
Then the command inbyte shall be used to get it.
Will post once I get the exact procedure.
 
microblaze input

Get Digilint's Nexys 2, which gives you 38MBps readback by using its DLL and board's built-in USB communication link.
 
uart microblaze

as i m having spartan 3e starter kit i want to
implement communication using same board so
i will be very happy u can give me proper way to have rs232 communication.
thanks for reply
 

hyperterm paste to host

did you manage to get any useful info regarding taking your input from the hyperterminal...?!
 
nexys 2 + microblaze

hi salma
thanks for asking i got the solution to some extent in which i am taking 16 bytes input from hyperterminal and
then using them.
but when i am trying to take input from file that is directly reading file from hyperterminal it is giving me some garbage read so
i am sure i will solve that problem in near future and
will come with great results.
i will update all status of my code and wil let u know about same to u. ok.
 

microblaze using rs-232

Hi Mr.Avathar,

I am also having the same problem of feeding the data from hyperteminal to microblaze. can you help me to do this?

Thanks in advance

N.R.Kannan
 

print option microblaze

khamitkar.ravikant said:
hi salma
thanks for asking i got the solution to some extent in which i am taking 16 bytes input from hyperterminal and
then using them.
but when i am trying to take input from file that is directly reading file from hyperterminal it is giving me some garbage read so
i am sure i will solve that problem in near future and
will come with great results.
i will update all status of my code and wil let u know about same to u. ok.

Yes, please do update us with any solutions you find :)

Regards,
Salma
 

uart xilinx microblaze

to achieve the input from hyperterminal i used the API documentation function as
i declared array of integer and with function XUartLite_RecvByte(XPAR_RS232_DTE_BASEADDR); i have taken input and assigned to the elements of array
the input is taken using FOR loop for 16 bytes as i need only 16 byte input also
whenever we enter the character on Hyperterminal at that time only we recieve the byte (ASCII) value inside it is not necessary to hit Return key (Enter key after each input character.
if any questions regarding this i will be happy to guide and answer the same. thanks.
 

have u found a way to tranfer a txt file from hyperterminal to microblaze? i want to transfer a txt file that contains a 324bit signal! any ideas?
 

hello,

yes i found a way :)
here's an example that i wrote for getting numbers from 0 to 7 from the keyboard...and according to the number found, the leds on the board light up ...

please let me know if you need any further help

salma

-------------------------------------------------

while(1)
{

//reads from the Hyperterminal
input= XUartLite_RecvByte(XPAR_UARTLITE_0_BASEADDR);

//checks if the input is a value from 0 to 7
if ((input>= 0x30) && (input <= 0x37))
{
//prints the data read from the HyperTerminal
xil_printf("%c ", input);
//write the data to the LEDS
MY_LEDS_mWriteSlaveReg0(my_leds, 0, ~input);
}
else
//if the input is in valid ( not a value between 0 to 7) then prompt the user to enter a valid number
{
xil_printf("\n\rplease enter a VALID number to display on the leds (0 -> 7)\n\r");
}
}

-------------------------------------------------
 

Hi Salma,

I'm new to EDK, please shed some light on following queries:

MY_LEDS_mWriteSlaveReg0(my_leds, 0, ~input);

What is purpose of middle argument (i.e. 0) which you are passing in above function?

And how is this above function any different from XGpio_DiscreteWrite(&my_leds, 1, ~input); ?

When I try to compile your code, it will give error:

/cygdrive/c/NewProj/NewProj.c:32: undefined reference to `MY_LEDS_mWriteSlaveReg0'

Any thought how to fix it?

Thanks
 

Hello,

The middle argument is the offset location from the base that will be written to...

MY_LEDS_mWriteSlaveReg0(my_leds, 0, ~input);
is the write function that you'll use to write to your register ... that's only of course when you've created a peripheral called "my_leds" which contains a register...
this function is generated automatically by the peripheral wizard...

XGpio_DiscreteWrite(&my_leds, 1, ~input);
is just the normal gpio write function

:D

how to fix it ??
you got to have a peripheral containing a register...and you HAVE to call it my_leds...LOL...or call it whatever else but don't forget to change the name in the C code to match the generated function :) so try to make one first then it'll be fine
 

Thanks for your quick reply.

Here is what I've done so far to make peripheral containing a register my_leds.

2rfzm20.png


2gtx1ci.png



Not sure what is missing, becasue I'm still getting the same :|

error: /cygdrive/c/NewProj/NewProj.c:32: undefined reference to `MY_LEDS_mWriteSlaveReg0'

Here goes the complete source code:

#include "xparameters.h"
#include "xgpio.h"
#include "xutil.h"


//====================================================
int main (void)
{

int input;
XGpio my_leds;

while(1)
{

//reads from the Hyperterminal
input= XUartLite_RecvByte(XPAR_UARTLITE_0_BASEADDR);

//checks if the input is a value from 0 to 7
if ((input>= 0x30) && (input <= 0x37))
{
//prints the data read from the HyperTerminal
xil_printf("%c ", input);
//write the data to the LEDS
MY_LEDS_mWriteSlaveReg0(my_leds, 0, ~input);
}
else
//if the input is in valid ( not a value between 0 to 7) then prompt the user to enter a valid number
{
xil_printf("\n\rplease enter a VALID number to display on the leds (0 -> 7)\n\r");
}
}
}
 

Still waiting for reply.... :p

Following this tutorial, at least I figured out why my above code was not working. :D

Code:
http://vcag.ecen.okstate.edu/wiki/index.php/Creating_a_Driver_using_a_LED_peripheral

Why? Because it was missing #include "my_leds.h"

But here comes another one, in the tutorials it says my_leds.h header file will be automatically generated once you hit libgen (Software->Generate Libraries and BSPs)

However, it is not generating any header file by that name. So this is the new error I'm fighting with:

/cygdrive/c/LEDPeri/ledtest.c:3:19: error: myled.h: No such file or directory

BTW, Tutorial is running EDK 8.2 while I'm using 11.1!

Any help is highly appreciated :)
 

hi

try to add the header file manually from projectdirectory\drivers\src\*.h.

i don't know whether it will be the correct method
 

deepamj said:
hi

try to add the header file manually from projectdirectory\drivers\src\*.h.

i don't know whether it will be the correct method

Wish it was that easy. :eek:

But as I mentioned above, required header file is not generated anywhere in the project directory!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top