12-04-2009 03:07 AM
Hi to all,
Just want to ask, how are you going to send signals or data from your labview program going to my 8051 microcontroller board? I'm having problems communicating both. Your help will be much appreciated. thanks.
12-04-2009 04:34 AM
Hi jmvrd,
what exactly are you trying to do?
But you would need some sort of Digital Input/Output device to read/write the ports.
PS.: Don't forget the pull ups 😉
Regards,
12-04-2009 09:05 AM
Or, are you trying to communicate with the microcontroller over its serial port? If so, do you have a program running on the microcontroller to listen to and respond to serial communication?
Please provide more details on exactly what you're trying to do, as your question is too vague.
12-04-2009 09:00 PM
yah, thats what im trying to do. what il be doing, is that i have a labview program that simulates a typical an actual guitar. Its like a tutorial or a software responsible for teaching how to play a guitar with the basic chords and basic strumming patterns. Now, i cant figure out how i will transmit the data from the program going to the microcontroller since our microcontroller will be responsible for receiving signals from labview and it will transmit it to its specific motor assignment. The idea is, if i input A,B,C chords from the program, the microcon will respond to it, by lighting up a specific led in it. Here's the sample of my program so that you will have a more concise idea, on what im trying to accomplish, though its not final yet. Thanks for all the help!
12-04-2009 11:20 PM
I still don't understand what kind of help you are seeking as far as the microcontroller communication. It appears that you will be communicating to it over the serial port. Do you actually have code on the microcontroller? Do you have a protocol defined? Do you have a list of commands and responses?
As for the code itself, I would strongly suggest rethinking the approach. You have waaaaay too many local variables, and the use of so many individual controls makes the code difficult to write and to manage. Here's a list of recommendations:
12-05-2009 10:17 AM
What i want to do is that, if i type a chord, lets say A chord at the string command, the program will be able to send it to the microcontroller, then the board will be able to receive it, then eventually transmit it to necessary motors. However, for the mean time, i want to know how commands from the program will be transmitted going to our board. The attached serial2.vi in the previous post is my basic sample code on how to communicate through our microcontroller. The microcontroller has a C program embedded in it. Attached is the sample/test program, currently programmed in our 8051 board.
Wow! i was astouned by your program! its very nice! and i find it a bit sophisticated and confusing, since im only a beginner in this and still studying the functions of this program. Will try to digest everything you suggested and will try to embed those things to our program. Thanks for all the comments and suggestions! greatly appreciate it. Please feel free to comment more on this and on the program itself. Thanks a lot guys!
12-05-2009 02:28 PM
Since it appears that you have a serial port interface running on the microcontroller, then all you need to do is to send the specified characters over the serial port. Based on the c code that you uploaded it appears the commands are simply single characters. It does not appear that the device sends anything back, so you wold have nothing to read from the serial port. Thus, you don't even need to use a subVI. You can have the serial port initialization at the start of the program and just use a VISA Write whenever you "play" the new chord. I don't think you really need to get too hung up on this aspect of it since it's relatively easy to include a VISA Write whenever you "play" the new chord. Thus, I would suggest concentrating on simplifying your program so it's easier to manage.
Wow! i was astouned by your program! its very nice! and i find it a bit sophisticated and confusing, since im only a beginner in this and still studying the functions of this program.
Sometimes you need to think outside the box. I'd guess that you have a background in text-based programming. The example VI I wrote is fairly simple. The 2D array on the block diagram simply pre-defines the strumming patterns. The rows are the individual patterns, and the columns are the picture states you want to show (0 = nothing lit, 1 = up is lit, 2 = down is lit). The row (strumming pattern) is indexed out based on the front panel control. Then we just need to go into a loop that walks through the pattern. An array of all "off" pictures is initially created and then in the loop we just replace the next element in the sequence based on the pattern that was selected.
12-05-2009 10:42 PM
Actually, we need to device a feedback system for us to be sure that the board receives the necessary data we're sending, so i think we would still need the VISA read command, however, we'll just do it after we figured out the VISA write properly. As much as i dont want to get too hung up here, i need to figure this out first, then the revision of the program will follow, after i successful send a data to our board, then i can concentrate on revising our program.
Yah, i have a little background in C, and still studying labview. Thanks for all the help and the explanation. will upload another VI of our program with your suggested structure. Btw, let me ask, in my program is it more advisable to use a stacked sequence rather than using a flat sequence? im planning to change all my flat sequence to a stacked sequence so that it will be easier for us to manage the said program. thanks again!
12-05-2009 11:11 PM - edited 12-05-2009 11:20 PM
NO! DON'T DO IT! A flat sequence is almost always better than a stacked sequence. What makes you think a stacked sequence would be easier for managing the program?
Pros for flat sequence:
Only advantage to stacked sequence:
12-05-2009 11:15 PM