prejudice I wanted to bring attention to a bug mikroBASIC pro PIC32, in practice I found that the instructions HI and LO are not working correctly
I noticed when I used this code
sub procedures WrData (size data as word)
SPI2_Write (hi (data))
SPI2_Write (the (data))
end sub
Then I tried to use the correct code
sub procedures WrData (size data as word)
SPI2_Write (data >>
SPI2_Write (data)
end sub
and now works well, then the problem will definitely function HI
function error
- viktor.milovanovic
- Posts: 240
- Joined: 08 Jun 2015 10:09
Re: function error
Hi,
In the help file, for the Hi function, parameter is declared as longint, while your parameter is word.
Try calling the function with the parameters as longint.
Best regards,
Viktor Milovanovic
In the help file, for the Hi function, parameter is declared as longint, while your parameter is word.
Try calling the function with the parameters as longint.
Best regards,
Viktor Milovanovic
Re: function error
Hi, the code below works (both versions of the procedure WrData):
Your code did not compile:
"the" was used in stead of "lo", "size" was used in stead of "dim" and "data" is a reserved word in mB.
Code: Select all
program HiLo
' Declarations section
dim Bte as byte // test replacament for SPI_write
sub procedures WrData (dim data_ as word)
Bte = hi (data_)
Bte = lo (data_)
end sub
'Then I tried to use the correct code
sub procedures WrData2 (dim data_ as word)
Bte = (data_ >> 8)
Bte= (data_)
end sub
main:
' Main program
WrData(1000)
WrData2(1000)
end.
"the" was used in stead of "lo", "size" was used in stead of "dim" and "data" is a reserved word in mB.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)