Q: where can I find a list of commands that are available?
In the keywords section of the documentation
Q: Can I save may functions to Flash?
Yes, when you have entered them, by hand or downloaded simply type flsave("") and your function will be in flash.
Q: How do I make a program so that it runs at start up?
You create a function with the name 'main()'. ByPic will look for this in start up and run it first.
Q: I have saved some functions to flash with flsave("") - how do I unsave them?
use flclear(0) to clear all of the user function from flash
use flclear(1) to clear functions that were saved on the last flsave("")
Q: main() has an endless loop and when ByPic starts it runs it so I can't type flclear(0) to get rid of it what do I do?
- If using an MX1 the BvSerial program has a command called .loopbreak (dot loopbreak) that is very effective at removing continuous loops. It will also clear the flash.
- This also works with MX3
- For devices that are upgradable (they have a boot loader) simply re-install ByPic
- See also the Language Guild main()
Q: Can I list the program in Flash?
NO: If the device supports full function names (MX3) then you can see a list of functions using list(1) but all functions when entered into the device are compiled, the text is not retained. This is exactly the same as asking if you can see the source code of a C object, library or execution file.
Q: Can I edit the function in Flash?
NO: Because the functions are compiled see (Can I list the program in Flash?). Editing is done in text outside of the device (PSPAD) and then downloaded using either BvSerial or BV_COM
Q: Chopped of strings
In the above example test_1 will only print a partial string this is because the string length is set to a small value. To print the whole string change the s$ in the function test_1 to be s$ or whatever you need the string to be. It is up to the coder to set the length of the string. The default value can be changed if required see “flsys”
Q: The sting contains “?#@_a “
This is a global variable that has not been initialised by you the coder. It deliberately has odd text in to warn that it has not been initialised.
Q: Expecting ) or other Errors
Sometimes the error does not match exactly what is wrong, this is because when loading you only see the last error and there may have been other previous error notifications that were more useful. The clue to this is the number of warnings, if it is and error which stops the loading and there is more than one warning then the error message is not likely to be helpful. The chances are it will be an undefined function. If you can t see the problem then type the offending line in manually, this will then give the first error message which is missed by loading.
Q: Not loading correctly
- Make sure there is at least one extra line at the bottom of the file.
- There must be nothing, not even spaces after the end of the program except one or more blank lines. If a blank line contains spaces and it occurs after the program end then loading produces some strange results.
- If you get file not found error then clear the drop drop down list on BV_COM and brows for the file again.
- Something like this: error line 12 >><!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”<<
ERROR (0) <<!DOCTYPE>
is because the include file is not being found so this is the top of the 404 page. Try putting the include file in the browser URL to see if it exists
Q: Comparison does not work – use brackets
This will give an unexpected result:
if strlen(a$) > size-1
The above will be true even if the length of the string is less than size-1. To make this work correctly the expression must be enclosed in brackets thus if strlen(a$) > (size-1)
Q: What's the differences between MX1 and MX3
MX3 refers to the PIC32 device family. This chip is an MX1 and the other BV boards use an MX3 – e.g. PIC32MX340F512H
On the MX1 device there are only port A and B (BV502 also has port C), the MX3 devices (on the BV Boards) don’t have a port A but have ports B,C,D,E,F and G.
The register addresses are different, port B register address on an MX3 device is different from that of port B on an MX1 devices and so if there are any example that use say port B, even though there is a port B on the MX1 you must change the register address.
This MX1 also supports a PPS (Peripheral Pin Select) which does not exist on the MX3 devices.
The MX1 does not have a boot loader and so mB cannot be replaced as it can on the MX3 versions. Because of this and because it is possible for the user to program a closed loop within main there is a ‘get out’ built in. The MX1 will pause at start up for a very brief period (about 0.5 seconds). If it receives through UART 2 a ‘\’ within that time period function ‘main’ will be aborted. The user then has the opportunity to use flcear.
Update for Autumn 2014
There are some new devices coming along, MX170 and MX370. The MX170 has 256k of Flash and so will be upgradable unlike the older MX150. They both have much more RAM.
In order to fit in the MX1 device some functionality has been removed, namely the SD Card interface and floating point. In addition peripheral support such as I2C and SPI are not part of the language. However these can be easily added via user functions.
All versions now include floating point.
Update for Autumn 2014
With the new MX170 there is double the amount of flash and so floating point has been put back, also these devices now have a boot loader and so are upgradable.