New updates to TGRK:
- EEPROM: Added keywords for saving or reading a byte our of the last 3 bytes in eeprom.
- E1S, E2S, E3S: these keywords are straightforward. [E1S 126] will save value of 126 to eeprom byte E1 (address 511). E2=510, E3=509.
- E1R, E2R, E3R: these keywords are for reading those same bytes. I need to add this to the "get_token_value(int8_t addr)" function, which current checks if a token is a number or register and gets its value. Then these eeprom bytes can be read in the same way. For testing reasons, currently when ExR is called, it simply replaces the ExR program byte with the byte retrieved from eeprom. This was just to test if keyword is working. It is very odd and interesting having a program that edits itself, and although I find it kind if cool this is not going to stay that way.
- BUTTONS: added BS, BT, BR, BL keywords for checking for button input within interpreter. This function is non blocking in the sense that interpreter loop keeps running, buttons and vcc voltage continue being checked on schedule, but program position does not advance until chosen button is pressed. BR is excluded as this is our button to halt the program. I had the hardest time getting this to work. For some reason my function for checking buttons was unable to pass the button ID parameter to parser. I am unclear why this was happening, but eventually ended up setting up a global variable for what button was pressed last. This works but not ideal.
- Function Return Addresses:
F1# L0H # (jump ret[1]) F2# S1 # (jump ret[1]) F3# L0L # (jump ret[1]) F4# F1 (ret[1]=15) F2 (ret[1]=16) F3 (ret[1]=17) F2 (ret[1]=18) LP # (jump ret[0]) F4 (ret[0]=21)
Another issue I am having I am working out is having multiple function return addresses at once. I want to be able to call functions from within functions, so instead of just having 1 return address for resume program from where function was called, i was storing these addresses in a uint8_t ret[8] array. Every time a new function is called, the index of this address array is incrimented, then on return, it is decrimented. Something isnt working with this so i need to test more. Example of nested functions above in psuedocode. - Pin Control: I have succesfully implimented controlling PB2 as output from within TGRK. I am thinking configuring the input similar to EEPROM read, where when configuring it as input it is like reading a number or variable with value of 1 or 0. I will also add keywords for using PB2 as analog pin. I want to also give an option for setting it as an interrupt, but as that would be more complicated is last priority. Pin Control keyword prefix will also have option to read VVC adc pin, getting a 2 digit number in return: 5.5v= 054, 1.8v= 018, and so forth. PB2 anlog function may work in the same way, or return scaled down raw adc value. Unsure yet.
I am probably forgetting something, but unsure what it is. There are a few random bugs I am working out as well. Debugging is slow on this setup and as the program code gets larger there is more going on.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.