Jump to content

Ian Harris

  • Content count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Ian Harris

  • Rank

Contact Methods

  • Website URL
  • ICQ

Profile Information

  • Location
    London, UK
  1. How about multiplying by 100, rounding that result, then dividing by 100?
  2. Very happy to play with a beta stack. - Ian.
  3. Sourceboost Ide Crashes On Startup / Loading Project

    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; and 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. cheers Ian.
  4. 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. [settings] Target=PIC18F26K22 Active Compiler=BoostC Active Directory=D:\TI\CC3000BasicWiFiApplication\Basic WiFi App Sourceboost Source\ Active Config=Debug Last Ext=h Type=0 Warnings=2 Model=0 [Files] Count=24 File0=CC3000HostDriver\cc3000_common.c File1=CC3000HostDriver\cc3000_common.h File2=CC3000HostDriver\evnt_handler.c File3=CC3000HostDriver\evnt_handler.h File4=CC3000HostDriver\hci.c File5=CC3000HostDriver\hci.h File6=CC3000HostDriver\host_driver_version.h File7=CC3000HostDriver\netapp.c File8=CC3000HostDriver\netapp.h File9=CC3000HostDriver\nvmem.c File10=CC3000HostDriver\nvmem.h File11=CC3000HostDriver\security.c File12=CC3000HostDriver\security.h File13=CC3000HostDriver\socket.c File14=CC3000HostDriver\socket.h File15=CC3000HostDriver\wlan.c File16=CC3000HostDriver\wlan.h File17=application_version.h File18=basic_wifi_application.c File19=board.c File20=board.h File21=spi\spi.c File22=spi\spi.h File23=spi\spi_version.h [Tools] BoostDir=C:\Program Files (x86)\SourceBoost\ Programmer= PrefixWithBuildThreadNum=1 BuildThreadNum=1 [Debugger] DebugFromMain=1
  5. Pic32 Support

    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. cheers Ian
  6. 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. Still. It would be so nice if we had a PIC32 version of Sourceboost.
  7. 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: /* Blink 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 http://arduino.cc/en/Tutorial/Blink 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 }
  8. Usb Serial Port!

    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, Ian. iharris [at] embeddedadventures.com
  9. 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 Enjoy! 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 Functionality 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)
  10. 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. cheers Ian. Hi, for all those who find USB difficult can try a simpler way of implimenting USB in ur PIC projects. http://tracesystemsinc.com/all-usb-product...ucts-alias.html Dave & Pavel, it will be nice if BoostC can be integrated in HID maker. Regards Raghunathan.P
  11. 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). cheers Ian.
  12. 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); #endif #ifndef turn_analog_inputs_off() #define turn_analog_inputs_off() \ #warning "!!! - See pic_utils.h for turning off analog inputs on your pic" #endif 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 #else #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() #endif
  13. Let me know how you go. It's a great compiler, with great support. cheers Ian.
  14. Thanks Pavel, project sent. kind regards Ian.
  15. 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): Building... BoostC Optimizing C Compiler Version 6.97 (for PIC18 architecture) http://www.sourceboost.com 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 ..\BoostBloader.c 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 failure 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' Done Failed 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() #endif 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) http://www.sourceboost.com 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 ..\..\pic_pack_lib\pic_serial.c 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 ..\..\pic_pack_lib\pic_utils.c ..\..\pic_pack_lib\i2c.c 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\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_screen_buffer.h(40): WARNING: 4 draw buffers ..\..\pic_pack_lib\draw\draw.c ..\..\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_font_picpack_5x7.c ..\..\pic_pack_lib\draw\draw_screen_buffer.c ..\..\pic_pack_lib\draw\draw_screen_buffer.h(40): WARNING: 4 draw buffers ..\..\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\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 ..\..\pic_pack_lib\pic_term.c C:\Users\iharris\Documents\My Dropbox\Programming\Projects\ea_mega_clock\ea_mega_clock.c(117): error: failure failure Failed to locate output file '.\ea_mega_clock.obj' Done Failed The line in question is "void configure_system" (117): void timer_1_callback() { // refresh display from draw buffer drv_refresh(); } // 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 Ian.