Direct bit access of Words(16-bit)

Post your requests and ideas on the future development of mikroBasic PRO for PIC.
Post Reply
Author
Message
Megahurts
Posts: 900
Joined: 01 Oct 2009 22:48
Location: Rocky Mountains, USA.

Direct bit access of Words(16-bit)

#1 Post by Megahurts » 27 Aug 2010 03:01

I found this unusual circumstance during my current project coding and am wondering if it is already possible, or can you guys consider it in future releases.

I really like mB Pro's assignable 'Symbol' feature and use it a lot in my projects, but on this project I was just programming away without thinking fully about the context of the variables I was using and did this:

Code: Select all

'------------------------------------------------------------------------------
Symbol RELAY_1 = PE_GPAB.0        
Symbol RELAY_2 = PE_GPAB.1        
Symbol RELAY_3 = PE_GPAB.2        
Symbol RELAY_4 = PE_GPAB.3        
Symbol RELAY_5 = PE_GPAB.4        
Symbol RELAY_6 = PE_GPAB.5        
Symbol RELAY_7 = PE_GPAB.6        
Symbol RELAY_8 = PE_GPAB.7        
Symbol RELAY_9  =  PE_GPAB.8      
Symbol FUEL_PUMP = PE_GPAB.9    
Symbol VENT_FAN  = PE_GPAB.10   
Symbol RELAY_10  = PE_GPAB.11    
Symbol TS_POWER  = PE_GPAB.12   
Symbol PM_SLEEP  = PE_GPAB.13    
Symbol RS232_EN  = PE_GPAB.14    

dim PE_GPAB as Word
'--------------------------------------------------------------------------------------
'   rest of program...........
I have not had a chance to run this code in a PIC, but the compiler did not give any error messages about it...?
The Language Reference Manual states that direct bit manipulation can done on Byte type variables.

Can we actually do this on Word (or larger data types?) this easily?

If not, is it something you could add easily to future versions?

I am not using that code in my program now, changed the Symbol assignments to two separate Byte variables just in case it would compile but not run on the PIC after examining the 'def' file for the PIC and seeing only declarations for bits 0-7 and B0-B7.

Just curious and would like the feature if possible as it would result in less program lines to mass modify the group and faster to pass along a SPI bus as one Word instead of as two separate Bytes...? (at least in mBasicPro, not sure about the coding size it would generate as a inline function or library routine)

Thanks again for a Great evolving product, Mhz. B^)

[edit] p.s. Sorry, forgot, using mBasic Pro V4 Beta when this happened. And not sure if it should be in the 'Beta Bug reports' instead of here? Kind of fits both. ? :oops:
Mhz.
Last edited by Megahurts on 05 Sep 2010 07:18, edited 1 time in total.
HW: easyPIC5|PICFlash2|easyBT|smartGSM|easyGSM|PICPLC16|mmWorkStation|FT800 Eve|PIC Clicker/2|
MMBs:PIC18F,PIC33EP,PIC32|CLICKs:DAC,ADC,GPS L10,Thermo,8x8B LED,Stepper,W/B OLED,9DOF,GPS3,tRF,Hall I|

SW: mP for PIC|mB for PIC-dsPIC-PIC32|Visual-TFT|

User avatar
tihomir.losic
mikroElektronika team
Posts: 2138
Joined: 02 Dec 2009 14:16
Location: Serbia
Contact:

Re: Direct bit access of Words(16-bit)

#2 Post by tihomir.losic » 27 Aug 2010 13:20

Hello,

I will pass that suggestion to our developers,
they will take this into consideration in our future development.

Thank you for your proposal and for pointing on this.

Best regards,

Losic Tihomir
mikroElektronika [Support team]

Post Reply

Return to “mikroBasic PRO for PIC Wish List”