News:

Let's find out together what makes a PIC Tick!

Main Menu

Possible addition to the compiler

Started by JonW, Nov 06, 2024, 07:33 PM

Previous topic - Next topic

JonW

Les, Have you ever thought of adding struct-like functions to the compiler such that you can use the .dot notation for long registers?  Many of the newer SOC have large 24 or even 32-bit registers that are split into several chunks, structs and unions  in C seem really powerful to keep track of them.   Like this:-

TYPE SensorData as word
  Data [0:7]
  Set1 [8:12]     
  Set2 [13:15]   
END TYPE


Dim VAR as byte = 0
Dim VAR1 as byte = 0


SensorData.set2 = 3
VAR = SensorData.data   
VAR1 = SensorData.Set3           ' Stored in a byte and in LSB , thus VAR1 = 00000011
HRSOUT Sensordata                 ' Sends the whole word
HRSOUT SensorData.Set2         ' only Set 2 sent out