Sending and receiving data PIC18F4550

OK, I have seen some forums on the way to talk with the LabView PIC18F4550 and did not find any solution up there, usually all the subjects this is ended with nothing.

OK, here's what I've done so far:

Part of microcontroller: I have downloaded the example of the Microchip Solutions, compiled the example for PICDEM card, however I have no card PICDEM, so I just set up my own simple Board with minimum elements. I have run this example on my PIC18F4550 and also used the standard Human Interface Device driver, I have run the example application and could turn on/off the LEDs and read potentiometer values. Then, once I saw that the device is working, I uninstalled the driver and unplugged my USB device.

Now: I found the manual on the site of NOR, which explains how to generate the pilot tool of NI-VISA, I went through it, and with generated success driver for my device and then I installed this driver, plugged my USB with PEAK and could see its properties etc.

So far seems ok. Now appears as a last step, I want to read data let the potentiometer through the PEAK.

According to the previous manual, now I use VISA Interactive Control tools, what im going to do now is to send requests to my PIC and get response/data from it.

Take a look at some of the code of the firmware on my PIC:

Sub ProcessIO (void)
{
Blink the LEDS according to the status of the USB device
If (blinkStatusValid)
{
BlinkUSBStatus();
}

Tasks user Application USB
< configured_state)||(usbsuspendcontrol="=1))">

If (!.) HIDRxHandleBusy (USBOutHandle)) //Check if data received from the host.
{
Switch(ReceivedDataBuffer[0]) //Look the host data sent, to see what kind of application specific command, he sent.
{
0 x 80-case: //Toggle control LED
blinkStatusValid = FALSE; Stop the flashing of the LED automatically, will now control manually.
If (mGetLED_1 () == mGetLED_2())
{
mLED_1_Toggle();
mLED_2_Toggle();
}
on the other
{
If (mGetLED_1 ())
{
mLED_2_On();
}
on the other
{
mLED_2_Off();
}
}
break;
0 x 81-case: //Get State of push button
ToSendDataBuffer [0] = 0x81; Back to the PC host the command echo we assume in the first byte. In this case, the command Get Pushbutton State.
if(SW3 == 1) //pushbutton no hurry, the pull up resistance on the circuit board is pulling on the high PORT pin
{
ToSendDataBuffer [1] = 0x01;
}
else //sw3 should be == 0, push-button is pressed and overwhelming pull upward resistance
{
ToSendDataBuffer [1] = 0x00;
}
If (!.) HIDTxHandleBusy (USBInHandle))
{
USBInHandle = HIDTxPacket (HID_EP,(BYTE*) & ToSendDataBuffer [0], 64);
}
break;

0 x 37-case: command /Read. POT Use ADC to measure an analog voltage on one of the pins of I/o ANxx and returns the result to the host
{
WORD_VAL w;

If (!.) HIDTxHandleBusy (USBInHandle))
{
mInitPOT();
w = ReadPOT(); ADC lets read the pin I/O voltage. See the relevant HardwareProfile - the stem of I/O that it will measure in the xxxxx.h file.
Some advice from demo, as the Council PIC18F87J50 FS USB plug-in Module, do not have a potentiometer (when used stand-alone).
This function call will always make however the analog voltage on the I/O pin. To make the demonstration more interesting, it
suggests that an external adjustable analog voltage must be applied to this PIN.


ToSendDataBuffer [0] = 0 x 37; Back to host the command echo we assume in the first byte. In this case, the command Read POT (analog voltage).
ToSendDataBuffer [1] = w.v [0]; Measure the analog voltage LSB
ToSendDataBuffer [2] = w.v [1]; Measure the analog voltage MSB

USBInHandle = HIDTxPacket (HID_EP,(BYTE*) & ToSendDataBuffer [0], 64);
}
}
break;
}
Rearm OUT for the next package endpoint
USBOutHandle = HIDRxPacket (HID_EP,(BYTE*) & ReceivedDataBuffer, 64);
}

} //end ProcessIO

As you can see he is ProcessIO function, with the presentation of the main switch, for example case 0 x 37: means if it gets this value from the host, it must send the value of the potentiometer to USB.

Now, what I tried to do is, in the interactive control of VISA, I selected the tab Interface IO and then tried to send the query with the value 0 x 37 in the field of the wValue, the bmRequestType was 0 x 0, and what I get is weird values I don't think that are the actual values of the potentiometer read... (I tried to change the potentiometer then do ask again and got the same values)

I also tried to experiment with basic i/o tab and got the same weird things...

so at this point, what I am doing wrong? what I need to / supposed to do now?

or can u point me to the source of valuable information?

or the LabView guru on this site, tell me please your opinion on this subject?


Tags: NI Hardware

Similar Questions

  • I am new to the ethernet communication using labview. I don't have any material. I have two laptop, I need to send and receive data through these 2 portable by using labview. Kindly help me on this.

    I am new to the ethernet communication using labview. I don't have any material. I have two laptop, I need to send and receive data through these 2 portable by using labview. Kindly help me on this.

    Dennis has already said: for a direct PC - PC connection, you need a cross over cable. If you connect through a router or a switch, you use a standard cable.

  • Send and receive data via the Ethernet Port?

    Hello

    I am trying to acquire details of LAN/Ethernet from the PC through LabVIEW.Like details, we get the date & time, etc Serial Port system, is it possible to get the details of my PC via LabVIEW.My LAN aims to sebd and Receive via Ethernet Port command.

    The last time I did it, I used the range of tcp. (I go ctrl + space for quick menu then type tcp). Open a connection to the network device, and then use tcp read/write, depending on the case. There are examples that can be very useful

  • Send and receive data packets on the network

    Hi all.

    Let's say I have a GPRS Modem that sends a data packet to an IP address of a server.

    How can I receive and read the packet data using Labview?

    In other words, how can I send a packet of data to the server using Labview?

    Thank you.

    Dear UOI,

    First of all, in my opinion, you must decide which protocol you we will use to connect both sides of the application.

    Is that UDP or TCP, for example?

    Reading of the package depends on the Protocol, according to me. But it is possible.

    About these two examples of Protocol that I quoted, that's two white papers for you to analyze.

    LabVIEW basic TCP/IP communication

    Communication UDP in LabVIEW

    Kind regards

  • Is anyone having problems with their 6 s new more not to send and receive images through text messages unless your cell data are lit?  Even if I'm on wifi, I won't get it the pic unless the cell data is on?

    Is a person with problems with their new 6s more iPhone send and receive pictures via SMS?  Even if I'm on WIFI, I have my cellular data button turned to receive a picture. Then in turn instead to use WIFI, it devours my data plan. If to halfway through the month I get warnings that my data plan has almost disappeared. I did everything, including resetting the phone to factory settings. It also does not send a text if IMessage is turned on. It switches immediately to Imessaging which of course, again use my data plan. Of course, I could use some help with this. BTW, my text messaging service is connected to my phone number and not my email. Who was one of the suggestions that support Apple told me to check. Never in my life have had so many problems with a phone since I bought this iphone 6 s.

    Mgibson2425 wrote:

    Is a person with problems with their new 6s more iPhone send and receive pictures via SMS?  Even if I'm on WIFI, I have my cellular data button turned to receive a picture. Then in turn instead to use WIFI, it devours my data plan. If to halfway through the month I get warnings that my data plan has almost disappeared. I did everything, including resetting the phone to factory settings. It also does not send a text if IMessage is turned on. It switches immediately to Imessaging which of course, again use my data plan. Of course, I could use some help with this. BTW, my text messaging service is connected to my phone number and not my email. Who was one of the suggestions that support Apple told me to check. Never in my life have had so many problems with a phone since I bought this iphone 6 s.

    SMS is a function of the carrier, you will need to contact your cell phone provider and see what is the matter.

    IMessage uses very little data.

  • My messages send and receive txt messages not iMessage on my iPhone and I don't know how to solve the problem to send and receive messages as iMessage

    My messages send and receive txt messages not iMessage on my iPhone and I don't know how to solve the problem to send and receive messages as iMessage

    Settings > messages > iMessage turn off then turn it back on...

    If it does not sign of your apple under messages ID.  Settings > General > reset > reset all settings (will not erase data).

    Then log in messages

  • Wireless drops IE7 but emails still send and receive the Satellite Pro L20

    I will try to write this, so it is logic-

    Satellite Pro L20

    Card Atheros AR5005G Wireless - Driver version 7.6.0.130

    Windows XP, Office 2003, IE 7,.

    Router Netgear WGR614 v6 wirless.

    When using a product like Utorrent my conection sharing internet it falls P2P file comes with - cannot display the page - usually I select the network diagnostics and he responds with consult the manufacturer of your computer for help.

    E-mails still send and receive ok - my wife on her cell phone can still access internet ok (so I don't think it's a fault of router)

    After I close the application down and let it during 5 minutes to share files so I can access the internet. If I connect directly to the router via a cable that I have all of the problems that makes me think it's a fault of the wireless adapter

    Can anyone help?

    Thank you very much

    Alex

    Hello

    Eventually the large amount of data that occurs during the influences of P2P file sharing or Skype session of the internet connection.

    Sometimes this question is displayed on my laptop if 2 or three laptops are connected to the same router.

    However, have you tried a few solutions stallions like WLan driver updated for example?

    Please check the Toshiba Wlan portal and install the latest version of the driver:
    http://APS.toshiba-tro.de/WLAN/

    Good luck

  • My Mac has stopped at random to send and receive text messages. Any thoughts?

    My Macbook Air stopped randomly send and receive text messages today. All software are up to date on my Mac and iPhone, and transfer of text messages is on my iPhone. Don't know what to do!

    You may have been signed off iMessage on your Macbook Air for some reason any. To check, open messages on your Macbook Air, click Messages at the top of the screen, then click on Preferences, tap accounts, click iMessage and login if you are not yet connected. If you try disconnecting and by signing insert it again. This should solve the problem. Let me know if this helped!

  • I have a question regarding windows mail. I was send and receive mail with no problems until last Thursday. I can still receive mail, but I can not send.

    / * moved from answers Feedback * /.
     
    I have a question regarding windows mail. I was send and receive mail with no problems until last Thursday. I can still receive mail, but I can not send. My email is with bellsouth.net and comes in my computer through windows Messaging.  I spent an hour and a half on the phone with bellsouth, and they say that the problem is with my windows mail.  I tried to use a restore date, and that did not help either. I will post a copy of this message, as I keep getting.  Your server suddenly put an end to the connection. The possible causes for this include server problems, network problems, or a long period of inactivity. Object 't', counts: 'mail.bellsouth.net', server: 'mail.bellsouth.net', Protocol: SMTP, Port: 25, secure (SSL): no, error number: 0x800CCC0F thanks for any help.

    Sometimes, WinMail settings get screwed up and you must remove the account and then add it back back.  Make sure first that the antivirus software not interfere (see www.oehelp.com/OETips.aspx#3).   Delete your account completely, then close WinMail.  Then compact and repair the database of WinMail (see www.oehelp.com/WMUtil/).  Add your account to mail back once again, and then make sure you have the correct settings under Tools | Accounts | Mail | Properties | Servers and | Advanced to what AT & T Specifies to WinMail (or OE).  Then see if it works.

    Steve

  • Connects to the router, but cannot send or receive data

    I have a WRT54G.  I can find the network and connect to the router, but I can't send or receive data.  I tried to connect directly to the router and I still not able to send or receive data. Both computers on the router has the same problem.  I did a reset the router back to the settings by default and still no luck.  Any thoughts?  Thanks in advance for the help.

    The first thing you can try is when you the Modem and the router is connected to the other, disconnect the power from the router and Modem, wait 30 seconds and then plug in the power to the Modem and once all the lights are solid, then connect the power supply to the Linksys router, now check if you are able to go online. If still no then...

    Who is your ISP. So I think you need to re - configure all settings of your router again.

    If your Internet Service is cable follow this link

    If your Internet Service is DSL follow this link

  • Cannot send and receive UDP

    I'm doing a code to send and receive of UDP. The code works fine on the simulator of 4.2.

    But the same code doen't work on the device.

    String u = "udp://" + server_addr + ":" + server_port + ";" + client_port + "/internet.beeline.ru|UDP;tunnelauthusername=beeline;tunnelauthpassword=beeline";
    
    socket = (DatagramConnection)Connector.open(u);
    
    Datagram dt = socket.newDatagram( socket.getMaximumLength() );
    dt.setData( data, 0, length );
    
    socket.send( dt );
    
    socket.close();
    
    u = "udp://:" + client_port + "/internet.beeline.ru|UDP;tunnelauthusername=beeline;tunnelauthpassword=beeline";
    
    socket = (DatagramConnection)Connector.open(u);
    
    Datagram packet = socket.newDatagram(fullPkt, length);
    
    socket.receive(packet);
    

    BB 8300 with OS throws IOException in an attempt to send UDP in the line of 4.2.2.166

    socket.send( dt );
    

    BB 8100 with 4.5.0.110 resembles could not send UDP no exception thrown

    but never receive any UDP server.

    Such a code should work on 4.5 OS, at least I'm able to see rtsp video to youtube which use UDP.

    The cause is the firewall carrier that bloks incoming UDP for the phone.

    Also firewall change source port of the datagram received by the server.

    The solution I see is to protocols rtsp/rtp simuilate to bypass the firewall of carrier.

  • Real-time display and receive data from txt files

    Hello

    I am creating a Flash component and I'm doing an editor for him.

    The component itself receives all its parameters to a .txt file.  The editor is a form of reading/record, that initially loads the settings in the form fields, then replace the .txt file when the user presses submit.  Then, you update the component on any Internet site, you have to see the changes.  I plan also to import the swf of the component in the editor.

    Here is the php code I found to help me will do:

    <? PHP
    Enter the data in the table of $_POST
    $title = $_POST ["title"];
    $comments = $_POST ['comment'];
    $image = $_POST ['image'];
    Make a chain in a Flash format
    $toSave = "title =". "." $title. "& comments = '. '. $comments. "& image =". " $image;
    Open a file in write mode
    $fp = fopen ("anastasio.txt", "w");
    If (fwrite ($fp, $toSave)) echo "write = Ok;
    else echo "write error";
    fclose ($FP);
    ? >

    If I have correctly configured as3 to send and receive on the fields of form a dozen as an experiment.

    What I want to do now is to do more in real time, so that the changes are reflected in the component that the user types parameters in, rather than submit them htting and then having to refresh the component swf to see the changes.

    What is a good way to go about this?

    Thanks for your help on this one.

    Shaun

    AS3 textfields have a change event that is sent when a textfield text changes.  You can use it to update your text file.  refresh a component in another swf file will require you to use the localconnection class to communicate between the two rulers.

  • Thunderbird ceased to send and receive with the new update of Windows 10.

    Thunderbird ceased to send and receive e-mail. When I tried to send I got: "the message send failed.
    The message cannot be sent because the connection to the Outgoing server (SMTP) smtp.comcast.net was lost in the middle of the transaction. Try again. "My email loads on my tablet is not comcast. Firefox works is not my internet. Clues?

    Please start * Windows * safe mode with active network
    -win10 http://windows.microsoft.com/en-us/windows-10/change-startup-settings-in-windows-10
    Always in Windows safe mode, start thunderbird in safe mode
    - http://support.mozillamessaging.com/en-US/kb/safe-mode

    Problem disappear?
    Just reply to inform us of the results.

    Do you have non-comcast accounts where this does not happen?

  • Can I send and receive emails with Firefox?

    Can I send and receive emails using firefox?

    Firefox is not messaging components, but you can use webmail on sites like Yahoo! Mail and Gmail.

    Or you can use Thunderbird. https://www.Mozilla.org/en-us/Thunderbird/

  • Needs of synchronization forced to replace send and receive or else everything will not amount to a merger. When can we expect these features?

    I used Sync in the browsers chrome based and had to leave because he managed the synchronization in the same way as this. He did the meaning of thought, that it merges. What ultimately happens is all browsers that connects to it will have its settings and bookmarks scrambled.

    Please add forced Send and Receive with capacity of replacement as well as total manual operation.

    You can provide here that the reactions of Mozilla:
    https://input.Mozilla.org/en-us/feedback

Maybe you are looking for

  • Java with Facebook Firefox errors

    HelloWith Facebook, every time the screen just where I go to another page on Facebook, I received several errors of Java. Please see the attached screenshots. I'd appreciate any help with this error of Java.Thank you...

  • USB not visible content on the tablet Z2

    Hi there, everyone! When you plug a USB stick (Sandisk Cruzer Blade 64 GB in this case) I can't find any content. FileExplorer ES doesn't show any content (MP4 movies in this case) Is anyone know about this problem? I'm watching the movies that I put

  • My dvd is not working properly under Windows 7

    After having upgraded my Acer Aspire 5735z from Vista to 7 Home Premium, my dvd treats my like r rw discs. I can copy some files to them, then it will tell me what are the files on the disk, and I have new files to burn. If I try to burn them, it tel

  • Match color tool or plugin

    Hello worldHow to color match in first pro from one clip to another cilp. in fcpx, we have a tool called existing color...If first have something in color-(tool or plugin) matching

  • Photography question v single App

    What is the diff between Photoshop in the photo for $9.99 plan vs Photoshop in the only app for $19.99 plan?