LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

microchip pic18f8722

Hi,  I am trying to use Labview to program my microchip pic18f8722.  I am trying to write the program memory, but am not sure how to open a hex file, and then increment it to a specific address so I can program a block onto the pic.  This should work just like microchip's AN851.  I have Labview 6.0.  If anyone has suggestions I would greatly appreciate it.  Thanks.
0 Kudos
Message 1 of 6
(3,883 Views)
Hi T L,
you can open it as binary file and set the pointer in the file with the "Set File Position" function. Which interface do you use to program your chip?
 
Hope it helps.
Mike
0 Kudos
Message 2 of 6
(3,881 Views)
I am using VISA Serial.  Thanks!
0 Kudos
Message 3 of 6
(3,878 Views)
You will need to know the specific serial protocol for the chip in order to program the device. Do you know this? This should be defined in the datasheet for the device. As an alternative, you may find it easier to simply use Microchip's PM3Cmd utility to program the chip from the command line. You can call that utility from LabVIEW using System Exec.
0 Kudos
Message 4 of 6
(3,863 Views)
I do know the protocol, my boss does not want to use the PM3.  The protocol is In: <STX><STX>[<0x02><DLENBLOCK><ADDRL><ADDRH><ADDRU><DATA>...]<CHKSUM><ETX>.  The <DATA> is the blocks from the hex file.  The next problem I am having is the Read from File lets me start at a certain address, but then reads the whole hex file.  I want to be able to read one byte at a time.
0 Kudos
Message 5 of 6
(3,857 Views)
If you use the Read from Binary File by itself it will read the whole file. The output is a string, which is just a sequence of characters that are the bytes. You can do this and then simply use String Subset to get the bytes you want.

-OR-

You can do like Mike said and use the Open/Create/Replace File and then the Set File Position function. You will also need to specify to Read from Binary File how many bytes to read. Depending on your code you can choose to read the data as an array of U8s or as a string:


Set the offset and the number of bytes as needed. Since you're reading bytes the byte order shouldn't matter. Note that it's better to read the chunk you want rather than reading one byte at a time from the file. File I/O operations are very expensive and slow.



Message Edited by smercurio_fc on 07-18-2008 10:20 AM
0 Kudos
Message 6 of 6
(3,851 Views)