Definitely last time it was a better answer Rob...but there are so many
emails and I even don't know the right keyword to search.
See the procedure below. I need 8 bits for checking that a part of a code
runs only once inside the procedure and I do not want to define repeat_bit1
to repeat_bit8. Any chance?
-----------------------------------------------------------------
-- a filling glass char, specify the line and position
-- all stored in cgram address 0
-----------------------------------------------------------------
var volatile byte repeat = 0xFF
; var volatile bit*8 repeat_bit at repeat : 0
var volatile repeat_bit1 at repeat:0
var volatile repeat_bit2 at repeat:1
-- the same with all 8 bits
procedure lcd_filling_glass (byte in line, byte in position) is
if internal_isr_counter == 1 then
if repeat_bit1 then
-- issue: this code should run only once on all commented
lines below
lcd_custom ( 0, 0xf1, 0xf1, 0xf1, 0xf1, 0x0A, 0x04, 0x0e,
0 )
lcd_cursor_position(line,position)
repeat_bit1 = low
-- end of issue
end if
lcd = 0
elsif internal_isr_counter == 2 then
if repeat_bit2 then
--
lcd_custom ( 0, 0xf1, 0xf1, 0xf1, 0xf1, 0x0e, 0x04, 0x0e, 0 )
lcd_cursor_position(line,position)
repeat_bit2 = low
--
end if
lcd = 0
elsif internal_isr_counter == 3 then
--
lcd_custom ( 0, 0xf1, 0xf1, 0xf1, 0xf1, 0x0e, 0x04, 0x0e, 0 )
lcd_cursor_position(line,position)
--
lcd = 0
elsif internal_isr_counter == 4 then
--
lcd_custom ( 0, 0xf1, 0xf1, 0xf1, 0xff, 0x0e, 0x04, 0x0e, 0 )
lcd_cursor_position(line,position)
--
lcd = 0
elsif internal_isr_counter == 5 then
--
lcd_custom ( 0, 0xf1, 0xf1, 0xff, 0xff, 0x0e, 0x04, 0x0e, 0 )
lcd_cursor_position(line,position)
--
lcd = 0
elsif internal_isr_counter == 6 then
--
lcd_custom ( 0, 0xf1, 0xff, 0xff, 0xff, 0x0e, 0x04, 0x0e, 0 )
lcd_cursor_position(line,position)
--
lcd = 0
elsif internal_isr_counter == 7 then
--
lcd_custom ( 0, 0xff, 0xff, 0xff, 0xff, 0x0e, 0x04, 0x0e, 0 )
lcd_cursor_position(line,position)
--
lcd = 0
end if
end procedure
----------------------------------------------------------------
On Sun, Apr 11, 2010 at 11:44 AM, Rob Hamerling <[email protected]>wrote:
>
> Hi Vasile,
>
>
> On 04/11/10 07:28 pm, vasile surducan wrote:
>
>> I've asked a similar question before and Rob answered me, but I forgot it
>> :(
>> How can I use any of the 8 bits from RTCCAL_CAL without defining a name
>> for everyone?
>>
>> var volatile byte RTCCAL at 0xF3E
>> var volatile bit*8 RTCCAL_CAL at RTCCAL : 0
>>
>
> If you want to manipulate individual bits giving each a unique name is
> normal practice I would think. But you could also use '&' , '|' or '^'
> operations on the whole byte. For example for bit # 3 in RTCCAL you could
> use:
> RTCCAL = RTCCAL | 0b0000_1000 -- set
> RTCCAL = RTCCAL & !0b0000_1000 -- clear
> RTCCAL = RTCCAL ^ 0b0000_1000 -- flip
> If you want to be able to use the bit number in stead of 0b0000_1000 you
> could specify (0b1 << 3).
>
> But I do not see any reason to do bit manipulation on a binary variable.
> Normal practice would be to assign it a specific binary value, or by adding
> / subtracting / multiplying / dividing it with a binary value. Could you
> give an example why you need to manipulate the bits individually?
>
> Regards, Rob.
>
> --
> Rob Hamerling, Vianen, NL (http://www.robh.nl/)
>
> --
> You received this message because you are subscribed to the Google Groups
> "jallib" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<jallib%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/jallib?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jallib?hl=en.