MemoryAccess module added to the Wiki
Moderators: David Barker, Jerry Messina
MemoryAccess module added to the Wiki
Add a module for reading and writing to Program Memory
http://www.sfcompiler.co.uk/wiki/pmwiki ... moryAccess
http://www.sfcompiler.co.uk/wiki/pmwiki ... moryAccess
Hi Tim.
Nice Work. I'll manage a little time to test it.
Hi Steven,
Writing a bootloader is not as easy as it seems (actually impossible with Swordfish Basic without acrobaties). The problem is not in writing in code space of pic mcu, the problem is to be able to store a PROGRAM at a SPECIFIC position in Code Space. Until now, Swordfish does not allow to put a specific code at a certain ABSOLUTE address in code space. David stated that he (perhaps) will manage to add a ORG-ing possibility. This will let us to put at the start of the code a jump to the user program or to the bootloader code.
Regards
Octal
Nice Work. I'll manage a little time to test it.
Hi Steven,
Writing a bootloader is not as easy as it seems (actually impossible with Swordfish Basic without acrobaties). The problem is not in writing in code space of pic mcu, the problem is to be able to store a PROGRAM at a SPECIFIC position in Code Space. Until now, Swordfish does not allow to put a specific code at a certain ABSOLUTE address in code space. David stated that he (perhaps) will manage to add a ORG-ing possibility. This will let us to put at the start of the code a jump to the user program or to the bootloader code.
Regards
Octal
Thanks
I have a neat SMS type text entry program utilising constant arrays, but by using MemoryAccess.read instead I saved a whole heap of code, its an interesting example of how some thought when writing code has a big effect.
I'm also working on a corker of a set of modules that lets you add interrupts routines together. Very very simple to use and very modular.
I will start with the classic 7Seg Led clock and from a users point of view it could not be simpler.
BTW Octal I have that Enj code. It's written very tightly but is not very modular, do you want to have a look?
I have a neat SMS type text entry program utilising constant arrays, but by using MemoryAccess.read instead I saved a whole heap of code, its an interesting example of how some thought when writing code has a big effect.
I'm also working on a corker of a set of modules that lets you add interrupts routines together. Very very simple to use and very modular.
I will start with the classic 7Seg Led clock and from a users point of view it could not be simpler.
BTW Octal I have that Enj code. It's written very tightly but is not very modular, do you want to have a look?
Some thing else
I was talking to Dave about how I tried to read floats using readlongword and found it was not working, it turns out SF knew more about what was going on than me and was doing doing typecast conversions.
The work around obviously was to write a float version (below) but another trick was to force a type cast
Example... If I wrote
myfloatvar = ReadLongWord(@myarray4)
Then as myfloat is a float it gets typecast from a longword as the function deals with longword but by adding .aslongword the casting is forced to prevent the conversion
myfloatvar.aslongword = ReadLongWord(@myarray4)
Here is the other way using another function
// read a Float from ROM
Public Function ReadLongWord (pAddress As TABLEPTR) As Float
EECON1 = 0
EEPGD = 1
TableRead
result.Byte0 = TABLAT
TableRead
result.Byte1 = TABLAT
TableRead
result.Byte2 = TABLAT
TableRead
result.Byte3 = TABLAT
End Function
I was talking to Dave about how I tried to read floats using readlongword and found it was not working, it turns out SF knew more about what was going on than me and was doing doing typecast conversions.
The work around obviously was to write a float version (below) but another trick was to force a type cast
Example... If I wrote
myfloatvar = ReadLongWord(@myarray4)
Then as myfloat is a float it gets typecast from a longword as the function deals with longword but by adding .aslongword the casting is forced to prevent the conversion
myfloatvar.aslongword = ReadLongWord(@myarray4)
Here is the other way using another function
// read a Float from ROM
Public Function ReadLongWord (pAddress As TABLEPTR) As Float
EECON1 = 0
EEPGD = 1
TableRead
result.Byte0 = TABLAT
TableRead
result.Byte1 = TABLAT
TableRead
result.Byte2 = TABLAT
TableRead
result.Byte3 = TABLAT
End Function