// Welcome to PIC32-Basic // This gets the device details from a PIC32 register // and returns the contents of that register function wel_device dim DEVID%=0xbf80f220 result peeki(DEVID%) endf function wel_devid dim dev% dev%=wel_device // get contents print "This is an example of reading a PIC32 register" print "Contents of the register",dev% // This bit of the device id, determins the processor type id%=and(rshift(dev%,12),0xff) print "and device id is", id% select id% case 0x12 print "The device is PIC32MX340F256" case 0x16 print "The device is PIC32MX340F512" default print "The device is not yet listed" endselect endf function go print "Welcome to PIC32-Basic" print wel_devid print input "Enter any number " num# print "Decimal =", num# print "Hex =", hex$(num#) print "Log10 is", log10(num#) print "Number to 2 decimal places", format$("#.##",num#) endf