Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by Reynard

  1. I will add some more suggestions to the pot. I think I read somewhere that all 18F chips are flash and therefore can write to their own program memory. As said above, you can use a SD memory device with a FAT system on board but this is a large overhead on the bootloader as asmallri says. A parallel external flash device is not practical due to the large pin count needed for the address and data lines. There are plenty of serial flash chips with an SPI interface built in. These come in 8 pin packages (SO8 or similar) and many are 3.3Vish so watch out if you are using a 5V system.
  2. Sure a nice feature. I still prefer to use the full variable name for clarity to which variable I am using. Sometime sizeof(struct) is nice to use. It all depends on your code and preference I suppose. You will be wanting anonymous unions inside structs next Cheers Reynard
  3. put your long into a union along with an array of 4 unsigned chars. union { unsigned long temp; unsigned char arTemp[4]; } longTime; longTime.temp=ON_time_secs; eeprom_write(store_day, longTime.arTemp[2]); eeprom_write(store_day+1, longTime.arTemp[1]); eeprom_write(store_day,+2 longTime.arTemp[0]); or something similar to this. Cheers Reynard
  4. If you have the same variable name in both structures (could happen if structures where similar in content) then you would have to name the structure you need anyway. Anonymous structures are not ANSI C are they ? but a Microsoft C extention. May not be allowed in C++. My thrupence worth. Reynard.
  5. There are several bits in the configuration bytes that are set to '0' for an erased device. I kind of agree that the compiler should respect the device default values and only change the bits that have been declare in the pragma. Cheers Reynard
  6. Yes you are correct, it goes into the Extra linker options: edit box. Your boot loader will contain a jump/goto to address 0x0800 to start your application. Reynard
  7. Well, the USB and USART are separate devices and use different pins on the chip, so the answer is Yes you can use them both at the same time. The down side is that you will probably have to erase your PIC and install your own USB driver. Something like the Ian Harris USB library, then use the Microsoft CDC driver thingy to communicate with a PC. You can write your own USB driver for the PC if you want maximum USB speed but that is a bit more complicated. It may well be possible to have two USB drivers installed, but I don't know how the ECIO bootloader allows you to add/delete/change
  8. These are the configuration data for your PIC. Check out the header file for the details. #define _CONFIG1L 0x00300000 #define _CONFIG1H 0x00300001 #define _CONFIG2L 0x00300002 #define _CONFIG2H 0x00300003 #define _CONFIG3H 0x00300005 #define _CONFIG4L 0x00300006 #define _CONFIG5L 0x00300008 #define _CONFIG5H 0x00300009 #define _CONFIG6L 0x0030000A #define _CONFIG6H 0x0030000B #define _CONFIG7L 0x0030000C #define _CONFIG7H 0x0030000D Cheers Reynard
  9. Definitely a bug. Workaround: set_bit(TxChar,9); or TxChar |= (1 << 9); seem to work. Cheers Reynard
  10. Have you tried the compiler switch -isrnoshadow to see if that helps. See page 24 of the BoostC manual. Cheers Reynard
  11. Mave you tried posting to the Matrix Multimedia forum. The makers may have more of an idea. Matrix Multimedia Web Site Cheers Reynard
  12. Hmm! Maybe MPLAB doesn't work correctly then. BoostC debugger says it works for porta bits 0-3 using your code. Cheers Reynard
  13. If you have no interrupt vectors defined in your code then the code space for them is free for the linker to put whatever it wants in that space. Put interrupt() and/or interrupt_low() into your code and things will change. Cheers Reynard
  14. Warren, Have you added in the BoostC library file into your project as described on page 20 of the manual. Cheers Reynard
  15. Hi Jorge, As Pavel says, if you turn on 'All Warnings' you would have gotten a warning informing of loss of data. You can use the command line setting or in the IDE use 'Settings -> Options...' then click All Warnings. The compiler demoted your value of 500 by truncating to the last 8 bits leaving you with 0xF4 or 244ms as you got. All Warnings is good for beginners as it can pick out simple unintended errors of loss of data etc. It is also useful for experienced programmers to run their code through the All Warnings occasionally. We all have senior moments. Cheers
  16. delay_ms only takes an unsigned char value therefore should be in the range 1 - 255. Page 69 of manual. To get 500ms call the delay_ms(250) twice. Cheers Reynard
  17. I don't quite know what your are saying about the leap year problem. Can you expand a little. int leapyear; int year; unsigned char four; four = 4; year = 2002; leapyear = year % four; This code comes up with a leapyear = 2 as expected. Cheers Reynard
  18. The compiler usually has good reason for letting out this warning message. Have you looked at the call tree to see if the function that calls your missing functions is there ? Do you have any 'if' statements that always evaluate to false ? i.e. if (1 == 2) comparing constant with constant. Do you have any '#if' directives that always evaluate to false ? Do you have any code that is unreachable from your main() function and descendents or interrupts. There will be a simple solution somewhere in your code I have no doubt. Regards Reynard Another idea: Do you have
  19. Writing a bit on a port sometime depends upon the hardware attached to the port. Sometime you can write a '1' to a port bit, but when you read the port that bit can read as a '0' because the output pin voltage is less than the '1' threshold due to what is connected to the port pin. i.e. base of a transistor. To avoid Read-Modify-Write problems, I sometime use a shadow register in RAM. I do all my changes to the shadow register then do a write only to the port. If I need to know the state of an output pin I can refer to the shadow register which should reflect the port output. Updating
  20. Yes, but what are they set to when the bootloader was installed ? Watchdog ON or watchdog OFF etc.
  21. So what are the configuration bits set to then Dave ? Does EZ Controller data sheet tell those with these controllers what they are. Reynard
  22. As part of your startup and configuration of the device, you should read the GPIO and reset any interrupt flags before you start your main process loop. The change register has to be set to match the initial input port values so you have to read the port to make the current value the old latched value. I hope that makes sense! Cheers Reynard
  23. Have you tried reading the GPIO ports before clearing the interrupt flag GPIF. The port has to be read to end the change mismatch condition otherwise GPIF will just set itself again (page 21 of data sheet). Cheers Reynard
  24. Dude, I am all out of ideas. I assume you have configured your motor controller for the correct device so I won't ask. The watchdog timer is ON by default, so turn it OFF in the CONFIG section while you are developing. Watchdog timers are nice to have in finished code just in case something does not quite go to plan in your software. Try doing a wrap-around on the controller to see if you can recieve what you sent and compare the data. i.e. putc, getc, compare, putc, getc, compare, etc. Cheers Reynard
  25. How do you know it is not sending a NULL character ? What does your receiving device do with a NULL character ? Cheers Reynard
  • Create New...