LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to extract register names & their addresses from .inc file of a microcontroller

Hi,

 

I want to extract register names to a dropdown and their corresponding addresses from .inc file in such a way that when I select a register from dropdown, it has to also show its address in a string indicator.

 

However, only a part of .inc file consists of register definitions and the rest has bit definition of registers (unwanted). How can I extract this using labview?

 

Attached is a sample .inc file for PIC18F4620 device.

0 Kudos
Message 1 of 4
(2,799 Views)

registers are specified in .inc file in the following format:

 

PORTA            EQU  H'0F80'

 

 

where, PORTA is register name & 0F80 is its address. I want to extract this information for all the registers listed.

0 Kudos
Message 2 of 4
(2,783 Views)

Read the file line by line until you find "Register Files" (use for example Search/Split String).

Then, read again splitting each line in its tokens (use Scan String for Tokens).

Keep the first token as name and convert the proper substring of the third token to the address value.

Terminate when line is empty.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 3 of 4
(2,776 Views)

Use read file VI and later read it using search / split string as suggested before.

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 4 of 4
(2,765 Views)