Jump to content

Ian Harris

  • Content Count

  • Joined

  • Last visited

Posts posted by Ian Harris

  1. Jorge,


    Good find.


    I removed the files one by one until I found which one made it crash. I was fooled since I didn't think SourceBoost looked in the source files as it started, but it must do to read the "todo" list.



    volatile unsigned long ulSmartConfigFinished, ulCC3000Connected,ulCC3000DHCP,

    OkToDoShutDown, ulCC3000DHCP_configured;




    OkToDoShutDown = 1;


    were the lines in the source files to cause the IDE to crash on startup. Changing them to "OkToShutDown" allows the IDE to startup okay.




  2. Hi all,


    Running 7.11 and it has an annoying habit of crashing on loading certain project files - even one I have just created. Once it does this, of course, then next time it starts up it tries to reload the project and crash again.


    Here's a project file that crashes every time. Tried uploading but the forum says I'm not allowed to upload that sort of file.





    Active Compiler=BoostC

    Active Directory=D:\TI\CC3000BasicWiFiApplication\Basic WiFi App Sourceboost Source\

    Active Config=Debug

    Last Ext=h































    BoostDir=C:\Program Files (x86)\SourceBoost\






  3. Hi Jorge,


    The PIC18F8X20 range of devices do have an external memory interface - but they only run at 10MIPS, which is not quite enough for our applications.</p>


    It's the RAM that's really the problem, I would swap half the flash for more than 4k of RAM. Still, getting more than 16MIPS of performance would certainly help too.




  4. So having finally got to the point now where we need to do projects with the PIC32 (actually, the problem is RAM, not processing power, but you might as well make the step to 32 bits) and start the process of porting things to the Microchip compilers.


    It reminds me what a joy it is to work in the clean, straightforward world of Sourceboost. Let's ignore the fact that MPLAB is extremely unfriendly and confusing, or the fact that you can easily (accidentally) spend ages reading help files only to realise that the help is for the HITECH C compiler and not the C18 compiler (or the XC8 compiler, which appears to be HITECH, full of bugs, and also an incompatible syntax with C18!)


    Try and find out how much memory (flash and ram) a given function uses in MPLAB. Go on. I dare you.


    It does appear to use less flash - a sample program I tried used considerably less flash but three times as much ram,. but then I'm just beginning on this journey. My first guess from looking at why is that C18 clumps all the ram constant assignments such as strings into flash, and then zaps them all into ram using table reads at the start of the program - meaning that it uses all that ram from the start, but uses less flash since this is a more efficient way of storing data than SourceBoost's equivalent:



    serial_print_str("x: print my_var=0x");

    03B8 0E20 MOVLW 0x20

    03BA 6E37 MOVWF CompTempVar728+D'2'

    03BC 6E3D MOVWF CompTempVar728+D'8'

    03BE 0E30 MOVLW 0x30

    03C0 6E45 MOVWF CompTempVar728+D'16'

    03C2 0E3A MOVLW 0x3A

    03C4 6E36 MOVWF CompTempVar728+D'1'

    03C6 0E3D MOVLW 0x3D

    03C8 6E44 MOVWF CompTempVar728+D'15'

    03CA 0E5F MOVLW 0x5F

    03CC 6E40 MOVWF CompTempVar728+D'11'

    03CE 0E61 MOVLW 0x61

    03D0 6E42 MOVWF CompTempVar728+D'13'


    ...which happens at run time, when it's needed. Uses more flash, but saves on ram.




    It would be so nice if we had a PIC32 version of Sourceboost.

  5. Prompted by a comment made by Dave Jones on the EEVBlog we are looking at producing an "Arduino" compatible hardware platform based on a PIC microcontroller (and sourceboost, naturally).


    I confess to not knowing a great deal about this platform other than the fact that it's everywhere, and it is based on AVRs.


    This would allow BoostC / Microchip users to play with the same "shields" (daughter boards) that are prevalent in the Arduino community while maintaining your existing code base and development environment. There may even be some interest in porting the "sketch" platform as well. At first glance it looks like BoostC would be ideal for this environment due to the sketch's C/C++ ambiguity. I'm not sure about the value of being able to use Arduino-style Wiring sketches that are already out there - is there a lot of code floating around? What would be the point of merely substituting one chip for another, along with a reasonable software effort, if all you get is what Arduino provides right now?


    At the very least, having a PIC based board that takes shields, and you can plug into USB and start programming quickly has got to be a good thing. I'm in the middle of updating and moving tutorials on the PicPack library across to the new web site at Embedded Adventures and the next one is getting stuff working on real hardware. And I'm thinking, what hardware do I recommend? There's a gazillion PIC platforms of course, or even breadboarding. There's even a gazillion different models of PIC. Where Arduino really ads value, I feel, is in its "one-ness". That is, there's one Arduino (give or take). You get the hardware, you plug it in, you load up a sketch, and within about 30 seconds you're writing programs that flash leds. Then you start adding shields, building on your platform. It's a good story.


    Presuming there's some interest, I'm happy to develop the hardware platform. The PicPack library gives you a lot of stuff to get going and some simple additions to be more like Arduino/Wiring would be straightforward - the nice thing about the Arduino software is it hides a lot of the stuff you need to sort out with the hardware to get going with (notice the "pin 13" in the example below). This has got to be a good thing for beginners until they decide they need the control of doing everything by hand.


    Any thoughts? Any key aspects of the Arduino platform I'm missing here? Of course, we could take this in a completely different direction from Wiring etc, but I think the emphasis should be on making it easy for beginners to get started, with an easy slope to add more complexity when users are ready for it.


    The classic Arduino/Wiring example:


    Turns on an LED on for one second, then off for one second, repeatedly.
    The circuit:
    * LED connected from digital pin 13 to ground.
    * Note: On most Arduino boards, there is already an LED on the board
    connected to pin 13, so you don't need any extra components for this example.
    Created 1 June 2005
    By David Cuartielles
    based on an orginal by H. Barragan for the Wiring i/o board
    This example code is in the public domain.
    int ledPin =  13;	// LED connected to digital pin 13
    // The setup() method runs once, when the sketch starts
    void setup()   {				
     // initialize the digital pin as an output:
     pinMode(ledPin, OUTPUT);	 
    // the loop() method runs over and over again,
    // as long as the Arduino has power
    void loop()					 
     digitalWrite(ledPin, HIGH);   // set the LED on
     delay(1000);				  // wait for a second
     digitalWrite(ledPin, LOW);	// set the LED off
     delay(1000);				  // wait for a second

  6. I'm not sure if this has already been mentioned (the thread is quite long), but a complete USB CDC and HID implementation is available in the PicPack library (clean room USB implementation using SourceBoost). Complete source, examples etc.


    It's under active development, in fact, within a few days we should have it working with the fantastic 18f14k50 chip, meaning you can do your own USB serial port with a completely customisable PIC chip for less cost than a SiLabs or FDDI chip.


    We'll have some hardware supporting all this available shortly. Suggestions, problems, ideas, bug (fixes), please let us know.


    See www.embeddedadventures.com


    kind regards,


    iharris [at] embeddedadventures.com

  7. PicPack 3.0 has been released - a bunch of source code designed to help make your life easier programming the Microchip PIC, using SourceBoost.


    Please see www.embeddedadventures.com




    Supported devices


    FM Radio: AR1000

    Temperature sensors: DS1631, TMP75, LM75

    Real Time Clock (RTC): DS1307, M41T81S

    LED display (4 digit): HC4

    Digital compass: HMC6352

    IEEE 802.15.4 transceivers: MRF24J40

    Propriatry transceivers: NRF2401A

    LCD display

    Pressure sensors: MS5540

    Humidity sensors: SHT15, SHT11

    Audio player: SOMO-14D





    Software i2c

    Audio queue

    Debug routines

    Conversion pseudo decimal to text for temperature display

    Config bits for PICs

    WPAN layer on top of MRF24J40

    Mesh networking on top of MRF24J40

    Flash write / erase

    Bootloader with examples for 16f876a, 16f877a, 16f88, 18f14k50, 18f2455, 18f252, 18f25k20, 18f2620, 18f26k20, 18f452, 18f4520, 18f4550, 18f67j50, 18f87j50

    Simple mesh network based on nrf2401a or nrf24l01

    Fully featured mesh network based on MRF24J40

    Software (timer-based) PWM

    USB library with CDC (serial port) and HID (mouse) examples



    Draw library


    Graphics library with support for pixel, line, rectangle, circle, bitmaps, text (fonts)


    Drivers for:


    EA LDP-6432 64x32 dual-colour LED display panel

    EA LDP-6416 64x16 dual-colour LED display panel

    EA LDP-8008 80x08 dual-colour LED display panel

    HT1632 based boards such as Sure 2416

    PCD8544 based graphic LCD (Nokia 3310)

  8. Raghunathan,


    I would be very happy to work with you on integrating HID maker, at least, if what you mean by that is producing SourceBoost C as opposed to Microchip C code. It looks like a very neat tool. We have a USB stack up and running in SourceBoost C and will be doing some development work on that over the next few weeks.





    I'm not new to pic programming, but I *am* new to USB programming. I have looked all over the place for a simple usb interface that will allow me to communicate with the pc using pic18f4553. I have found some snippets of code, but they won't compile or won't run.


    I have no real understanding of how to make this thing work with a PIC. Is there anyone eho has a very simple listing that will compile and run? I can't even get the computer to realize that a device has been connected.


    Just so you know, I have sourceboostC, but I am currently working with mikrobasic. I am certain I can port it over, but so far I have no idea what I'm doing. USB is very confusing to me. Can somone please help me?



    for all those who find USB difficult can try a simpler way of implimenting USB in ur PIC projects.




    Dave & Pavel, it will be nice if BoostC can be integrated in HID maker.




  9. Then I am correct in saying that the issue is with MPLAB. So it seems that my only solution is to place all of my files in one project directory, which is how I've been working. It would just be a bit cleaner if things could be a little more organized.


    I would like to be able to switch over to use the Sourceboost IDE, but then how do I program my devices with the ICSP port?


    Just load the .hex file in mplab (File | Import) and program it by choosing a programmer (eg PicKit2). Quick and harmless. Alternatively, you can use the pickit2 utility itself (if you have a pickit2), or for more fun and easier debugging, use a bootloader (there are stacks around).




  10. Just a note for the others, thanks to the excellent Sourceboost support, the problem turned out to be:



    #ifdef _PIC18F26K20
    #define turn_analog_inputs_off() clear_bit(adcon0, ADON);
    #ifndef turn_analog_inputs_off()
    #define turn_analog_inputs_off() \
    	#warning "!!! - See pic_utils.h for turning off analog inputs on your pic"


    Since I was using a new PIC, the code was designed to alert me that there was no turn_analog_inputs_off() routine by issuing a warning if it was used. Turns out that creating a #define using the #warning (which is a preprocessor function) within a #define is of dubious legality. If you get your head around it, you can imagine that the preprocessor runs through, doesn't see turn_analog_inputs_off() as defined, so it #defines it as a #warning - but at that point the preprocessors job is done, and then the compiler ends up seeing the code #warning, which of course it doesn't know what to do with.


    At least, that's my take.


    Solution is to issue a warning or error regardless of whether the routine is used.


    #ifdef _PIC16F88
    #define turn_analog_inputs_off() ansel = 0
    #elif _PIC16F876A
    #define turn_analog_inputs_off() adcon1 = 6
    #elif _PIC16F877A // Note - 16F877a unverified
    #define turn_analog_inputs_off() adcon1 = 6
    #elif _PIC18F4520
    #define turn_analog_inputs_off() adcon1 = 15
    #elif _PIC18F452
    #define turn_analog_inputs_off() adcon1 = 6
    #elif _PIC18F2620
    #define turn_analog_inputs_off() adcon1 = 15
    #elif _PIC18F4550
    #define turn_analog_inputs_off() adcon1 = 15
    #elif _PIC18F26K20
    #define turn_analog_inputs_off() ansel = 0; anselh = 0
    #elif _PIC18F14K50
    #define turn_analog_inputs_off() ansel = 0; anselh = 0
    #warning "See pic_utils.h for turning off analog inputs on your pic. Analog inputs will not be turned off if you use turn_analog_inputs_off()"
    	#define turn_analog_inputs_off()

  11. Hi guys,


    Having some fun with the new 18f14k50 chip - when compiling to this target, the compiler fails to compile, despite compiling fine for another target (eg 18f26k20). The failure lines don't appear to make much sense, sometimes it's a pragma line (as in this bootloader):


    BoostC Optimizing C Compiler Version 6.97 (for PIC18 architecture)
    Copyright(C) 2004-2010 Pavel Baranov
    Copyright(C) 2004-2010 David Hobday
    Licensed to Ian Harris under Single user Pro License for 1 node(s)
    Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited
    C:\Users\iharris\Documents\My Dropbox\Programming\boostbloader\chipdefs.h(271): WARNING: Compiling for PIC18F14K50
    C:\Users\iharris\Documents\My Dropbox\Programming\boostbloader\chipdefs.h(281): WARNING: Did you set -rb 15780 in Settings | Options | Linker?
    C:\Users\iharris\Documents\My Dropbox\Programming\boostbloader\configbits.h(116): WARNING: config for 18f14k50
    C:\Users\iharris\Documents\My Dropbox\Programming\boostbloader\configbits.h(121): WARNING: External crystal, PLL allowed
    C:\Users\iharris\Documents\My Dropbox\Programming\boostbloader\BoostBloader.c(85): WARNING: high speed uart disabled
    C:\Users\iharris\Documents\My Dropbox\Programming\boostbloader\BoostBloader.c(262): WARNING: led off
    C:\Users\iharris\Documents\My Dropbox\Programming\boostbloader\chipdefs.h(288): error:  failure
    "C:\Program Files (x86)\SourceBoost\boostc_pic18.exe" ..\BoostBloader.c -t PIC18F14K50 -W2 -Oa -Su -I "..\..\pic_pack_lib;..\" -obj ".\" 
    Exit code was 1.
    Removing target: .\BoostBloader.obj
    Failed to locate output file 'C:\Users\iharris\Documents\My Dropbox\Programming\boostbloader\18f14k50\18f14k50_12Mhz_48Mhz_PLL.hex'


    The line in question:



    #ifdef _PIC18F14K50
    #warning "Compiling for PIC18F14K50"
    #define pic_mem_16k
    #define pic_18
    #define erase_before_write
    #define min_erase_chunk 64
    #define max_write_chunk	16
    #define BLOADER_START 0x3da4
    #define BLOADER_UPPER 0x00
    #define BLOADER_START_HIGH 0x3d
    #define BLOADER_START_LOW  0xa4
    #warning "Did you set -rb 15780 in Settings | Options | Linker?"
    #define MOVED_BVECTOR_START 0x3d78
    #define MOVED_BVECTOR_UPPER 0x00
    #define MOVED_BVECTOR_HIGH  0x3d
    #define MOVED_BVECTOR_LOW   0x78
    #define JUMP_TO_BVECTOR1 0xefbc
    #define JUMP_TO_BVECTOR2 0xf01e
    // The next line is the "problem":
    #pragma DATA 0x0000, 0xd2, 0xef, 0x1e, 0xf0
    #define JUMP_TO_BLOADER1 0xef
    #define JUMP_TO_BLOADER2 0xd2
    #define JUMP_TO_BLOADER3 0xf0
    #define JUMP_TO_BLOADER4 0x1e
    //#define SERIAL_TRIS_SETUP()


    Sometimes it's just a function definition


    "C:\Program Files (x86)\SourceBoost\boostc_pic18.exe" -t PIC18F14K50 -W2 -I "..\..\pic_pack_lib" -obj ".\"  ..\..\pic_pack_lib\pic_serial.c ..\..\pic_pack_lib\pic_utils.c ..\..\pic_pack_lib\i2c.c ..\..\pic_pack_lib\tmp75.c ..\..\pic_pack_lib\m41t81s.c ..\..\pic_pack_lib\mrf24j40.c ..\..\pic_pack_lib\spi_hw.c ..\..\pic_pack_lib\its_mode2.c ..\..\pic_pack_lib\wpan.c ..\..\pic_pack_lib\its_common.c ..\..\pic_pack_lib\pic_timer.c ..\..\pic_pack_lib\draw\drv_sure_6432.c ..\..\pic_pack_lib\draw\draw.c ..\..\pic_pack_lib\draw\draw_font_picpack_5x7.c ..\..\pic_pack_lib\draw\draw_screen_buffer.c ..\..\pic_pack_lib\sure_6432.c ..\..\pic_pack_lib\pic_tick.c ..\..\pic_pack_lib\pic_timer1.c ea_mega_clock.c ..\..\pic_pack_lib\pic_term.c ..\..\pic_pack_lib\platform_leds.c
    BoostC Optimizing C Compiler Version 6.97 (for PIC18 architecture)
    Copyright(C) 2004-2010 Pavel Baranov
    Copyright(C) 2004-2010 David Hobday
    Licensed to Ian Harris under Single user Pro License for 1 node(s)
    Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited
    C:\Users\iharris\Documents\My Dropbox\Programming\pic_pack_lib\pic_serial.c(97): WARNING: You must set tris bits for serial use yourself, I don't know your pic
    C:\Users\iharris\Documents\My Dropbox\Programming\pic_pack_lib\pic_serial.c(98): WARNING: Please send your tris bits in so they can be included in the library
    C:\Users\iharris\Documents\My Dropbox\Programming\pic_pack_lib\i2c.c(164:12): warning: local variable 'in_byte' may be used uninitialized
    C:\Users\iharris\Documents\My Dropbox\Programming\pic_pack_lib\i2c.c(165): warning: conversion from 'unsigned char' to 'bit', possible loss of data
    ..\..\pic_pack_lib\draw\draw_screen_buffer.h(40): WARNING: 4 draw buffers
    ..\..\pic_pack_lib\draw\draw_screen_buffer.h(40): WARNING: 4 draw buffers
    C:\Users\iharris\Documents\My Dropbox\Programming\pic_pack_lib\draw\draw.c(317): warning: conversion from 'signed int' to 'unsigned char', possible loss of data
    C:\Users\iharris\Documents\My Dropbox\Programming\pic_pack_lib\draw\draw.c(320): warning: conversion from 'signed int' to 'unsigned char', possible loss of data
    C:\Users\iharris\Documents\My Dropbox\Programming\pic_pack_lib\draw\draw.c(328): warning: conversion from 'signed int' to 'unsigned char', possible loss of data
    C:\Users\iharris\Documents\My Dropbox\Programming\pic_pack_lib\draw\draw.c(331): warning: conversion from 'signed int' to 'unsigned char', possible loss of data
    ..\..\pic_pack_lib\draw\draw_screen_buffer.h(40): WARNING: 4 draw buffers
    ..\..\pic_pack_lib\draw\draw_screen_buffer.h(40): WARNING: 4 draw buffers
    C:\Users\iharris\Documents\My Dropbox\Programming\Projects\ea_mega_clock\ea_mega_clock.c(117): error: general error
    C:\Users\iharris\Documents\My Dropbox\Programming\Projects\ea_mega_clock\ea_mega_clock.c(117): error:  failure
    Failed to locate output file '.\ea_mega_clock.obj'


    The line in question is "void configure_system" (117):


    void timer_1_callback() {
    // refresh display from draw buffer
    // configure_system
    // Get the pic ready for everything we want to do
    void configure_system() {
    uns8 my_ea[8] = { 0, 0, 0, 0, 0, 0, 0, 5 };		
    kill_interrupts();	// turn off interrupts just in case
    turn_analog_inputs_off();	// kill those pesky analogue inputs
    // serial setup ----------------------------
    serial_setup(SPBRG_115200);	// set serial port up for 115.2k
    term_init();	// initialise terminal


    Both these projects compile fine if another target is chosen (eg 18f2620).


    Latest sourceboost RC, pulled from the website an hour ago.


    kind regards


  12. Panvadee,


    The LF and F devices are identical from a code perspective - they only differ in that the LF devices can typically handle lower voltages and/or higher clock speeds at lower voltages.


    As far as sourceboost is concerned, pick the pic16f648a and you'll be fine.





    What can I do if I use PIC16LF648a? It doesn't have any of the PIC16LFxxx on the list above.

  13. Are you running your PIC with an external crystal or using the internal rc oscillator? Obviously the crystal is going to give you better results.






    I am continuing to try to find where is the problem coming.

    By disabling the glitches option, I till have the same value in the LogicAnalyseur.


    I take a look with the oscilo with sampling at 125 k. The baud rate is found at almost 9600 in the two directions.


    Now instead from the PC I send the string "03 REMOTE STOP". Pic read "03 REMOOE STOP"


    If I send :


    • 11111111111111 read 11111111111111
    • 03 R111TE STOP read 03 R1111E STOP
    • 0123456789 read 0123456689


    All the time it is the character eight which take the value of the seven one. Does that can come from an error of the library ?



  14. Hi Darshan,


    How are you going now? Can you post the debug output from the pic?





    #pragma DATA _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _VREGEN_ON_2L


    internal 3.3V regulator should be on in config bits if one is connectiong VUSB to GND using 0.1uf cap .


    still i am not able to detect USB device with picpack library !.


    might be some more to be done .





    i have compiled picpack usb serial on pic18f2550 but when i connect it windows says that usb device could not be unrecognized .


    i have made my own proto pcb with vusb connected to VDD and did not pulled up D+ . is it right . can somebody post the USB schematics which is working with picpack . Although i have reffered to TechToys but they do no show their usb demo board as of now .




  15. Hi all


    Has anyone done any interfacing between PICs and the MRF24J40MA, also from Microchip, using SourceBoost?


    I'm thinking of using the ZigBee protocol, probably starting with the stack from Microchip.


    I've seen a few enquiries on this in the past, but have not seen any replies.


    Hi Tim,


    I've got a couple of those - actually the version "B" now - but it's the same base chip from what I recall. I've been planning to get those going under sourceboost for a while, so now might be a good time.




  16. Nice work, some great projects there!


    Not really BoostC stuff but I use this tool to help me develop with BoostC so maybe others will find it useful as well.


    I updated the GUI for my $10 logic analyzer to add support for busses, pretty colors and help. I put a little plug in for BoostC in the notes section of the screen dump.




    Here are some other projects. Most were implemented using BoostC



  • Create New...