Jump to content

Reynard

EstablishedMember
  • Content Count

    688
  • Joined

  • Last visited

Everything posted by Reynard

  1. http://forum.sourceboost.com/index.php?sho...3&hl=wizard A year on and still waiting. Real programmers don't use wizards anyway, they like the challenge of starting from scratch and rolling their own. :angry: Cheers Reynard
  2. Hi Mike, You need to check the mode pin of your EEPROM (pin 7). Multibyte = 1, Page = 0. You seem to be sending too many bytes. You only need device ID, memory address, then the data. There are only 512 bytes in the chip arranged as 2 x 256 byte blocks. The block is selected using A8 which is contained in the device ID byte (Bit 1). The 8 remaining address bits (A7-A0) are in the next byte. Cheers Reynard
  3. Mike, Are you working in multibyte write or page write mode ? Memory is in 8 byte pages. For multibyte you can write 4 bytes at a time which can cross a page boundary. You tell it the start address and write 4 consecutive bytes from there. If you cross a page boundary remember the write time doubles to 20ms as you have to write over 2 pages. For page write you write 8 consecutive byte in a complete page. When you set the start address the lower 3 bits will be ignored and start internally = 000. If you write less than 8 bytes I assume it doesn't matter it keep the previous data
  4. John, Did you try having a go at aggressive optimization (-Oa) to see if that squeezed any code bytes out. My copies of BoostC only go back as far as 6.86 so can't help there. Regards Reynard
  5. You may not have heard of Wiz-C by FED either. I don't have this currently installed on my machine just now so don't know if it does large arrays. Had a scan through the manuals but no joy. I am not a big PIC user so have no bias towards any PIC compiler although I do own a copy of BoostC. I just dabble with the others demo versions to see what they can do. I just offer my tupence worth to BoostC users. I was brought up on 8051 and Z80 cored devices like Dallas DS2001 and Rabbit 2000 etc. Shows you how old I am. Cheers Reynard
  6. Well MikroC can do large arrays. It uses FSR0 register and MOVFF instruction. Like this: unsigned char bigarray[500]; unsigned int index = 401; mybyte = bigarray[400]; mybyte = bigarray[index]; I am sure Dave and Pavel can squeeze this feature in the PIC18 library. Cheers Reynard ps. I didn't want to show you this but it comes out something like this: ; mybyte = bigarray[400]; $007E $C1C1 F030 MOVFF _bigarray+400, _mybyte ; mybyte = bigarray[index]; $0082 $0E31 MOVLW _bigarray $0084 $242E ADDWF _index, 0, 0 $0086 $6EE9 MOVWF FSR0L, 0 $0088 $0E00 M
  7. Hi Anna, I have no problems compiling with your CLOCK_FREQ pragma value. According to the manual BoostC only recognises 3 pragma directives so I don't know where your RS232 pragmas came from. The CLOCK_FREQ pragma is not required unless you are using one of the libraries that automatically calculate a value based on it such as the rs232 library. Delay routines (delay_us(X) etc.) use this pragma to let the compiler calculate software time loops. The only pragma you need to use is DATA to set your config settings. Cheers Reynard
  8. Anna, Are you using the SourceBoost rs232_driver library ? Your crystal is not exactly divisible down to 9600 baud. The value, 3.2768MHz is very similar to a watch crystal at 32.768kHz with 2 extra zeroes. I have no problems compiling with your #pragma CLOCK_FREQ. The UART will run at any frequency where the crystal is divisible by the BRG. 3.8684MHz is a standard value for generating baud rates with no frequency error. Setting the registers to the correct values is all you need to get the UART going. No extra pragmas required. Cheers Reynard
  9. There are several ways to skin a cat. 1. Use MAKESHORT(dst, lobyte, hibyte) macro. See manual. 2. Shift msb left 8 bits and add lsb. 3. Use an union. Cheers Reynard
  10. It's all to do with how the PICs are made. The RAM is laid out on 256 byte pages therefore the largest continuous block is 256 bytes before you have to start changing bank select addresses. It could probably be done but the code overhead in managing data and variable crossing page boundaries would make it not worth it. Cheers Reynard
  11. It does work Softy (SB 6.92). Are you searching the correct directory/path etc. Between the "Look in" drop down and the "Browse" button is a button labeled "." (dot). The sets the Look in to the project directory where hopefully your files are. Cheers Reynard
  12. Kenn, You must go back along way then. This is the synthesizer that I think used the cotton wool in a glass tube. http://matrixsynth.blogspot.com/2008/03/pr...ynthesizer.html My pile of Practical Electronic and Practical Wireless magazines of that era are long gone. Cheers Reynard
  13. Hi Shree, You are almost there. The variables tick and ticky will be initialised to zero every time the interrupt function is called. Just like any other function. If you make them "static" variables then they will only be initialised once. i.e. static unsigned char tick = 0; Rather than use static variable you could just make them global and initialise them in main(). This will save some overhead time wise in the interrupt function by not having to test the initialise static flag. Static variables are usually cleared by the startup routine unless told not to by -Su in the
  14. Alan, Your assignment has to be inside a pair of braces. Either the structure or a function/procedure. Cheers Reynard Well! Maybe not structures then
  15. Russ, Had wee look around and found this site. Good for your wiki maybe. http://www.engj.ulst.ac.uk/sidk/quintessential/ Cheers Reynard
  16. I didn't put in the obvious byte swaping part as you knew that bit. float myfloatfunc(char *inbuf) { union { float myfloat; char buf[4]; } floaty; //.... floaty.buf[0] = inBuf[3]; floaty.buf[1] = inBuf[2]; floaty.buf[2] = inBuf[1]; floaty.buf[3] = inBuf[0]; return floaty.myfloat; } unsigned char buf[4] would have read better. An unsigned long would have done just as well instead of the float. If you are using the BoostC float library then keep it as a float. Cheers Reynard
  17. You could try using a union. float myfloatfunc(char *inbuf) { union { float myfloat; char buf[4]; } floaty; //.... return floaty.myfloat; } Cheers Reynard
  18. Hi Shree, First of all I am going to recommend a good book for you. "The Quintessential PIC Microcontroller" by Sid Ketzen, published by Springer. ISBN 1-85233-942-X This is an excellent book for learning the ins and outs of the PIC. An ISR is a procedure that is called automatically by the PIC when an interrupt flag is being waved at it. The ISR procedure will return to the point left from when it runs out of instuctions and hits the closing brace. Just like any other procedure or function does. When timer0 rolls over from 0xff to 0x00 the TOIF flag will be set. Assumi
  19. I don't think modifiable static variables are allowed in inline functions (C99). Cheers Reynard
  20. Hi Shree, Timer 0 is set to run continuously and is being clocked by Fosc/4 or 1MHz if your PIC is running with a 4MHz osc. The timer 0 is set up using the option_reg = 0x08. Check out the bit settings. You can change the led change time by changing the tick and tick1 compare values. tick is running at 5ms per cycle and tick1 every 1s or 200 x tick. You may have to use unsigned int's to get some of the longer times. tick and tick1 probable should have been initialised = 0 during main for correctness but may have been cleared by startup code. See the -Su compile line option. T
  21. BoostC is a C compiler with an assembler as an add-on feature. As such the compiler is free to use whatever registers it requires to produce the most efficient code. As there is really no way of knowing what registers the compiler is using any assembler functions or inline code should preserve what it uses. Looking at the interrupt code, only FSR0, as well as the usual registers, is saved. This may say that the other FSR registers are not used by the compiler. This may not be the case in the future. Tread with care. Cheers Reynard
  22. You could try using a couple of M-sequence generators. One to output to a DAC the other to control the update frequency. This will not be completely random but peudo-random as the generators will repeat the sequence. The frequency range of the white noise will of course depend on how fast you can update the DAC. A DSP may be better than a PIC. If you want real white noise you could look at using a PN junction such as the be of a transistor. I have seen cotton wool soaked in silver nitrate inside a glass tube and a couple of silver wire used in a synthesizer. This was many years ago t
  23. I think the code produced by adc_measure() may not be correct for this chip. adcon0 is AND'ed with 0xc7 and the channel number passed is shifted left 3 bits. This means that CHS0 is being ignored. The 16F616 has 4 channel selection bit so the mask should have been 0xc3 and the channel selection shifted 2 bits. CHS3 should be kept = 0. The adc_measure does not work on PIC's that only have 8 bit adc, such as PIC16F716. Cheers Reynard
  24. If you have a look at the assembler code generated by the timer functions they will prbably show you software loops to do the timing based on #pragme CLOCK_FREQ. If a hardware timer was to be used they would tell you in the manual so that you did not use it for something else. Cheers Reynard
  25. HINT Look at the Version Log on the download page dude. Reynard
×
×
  • Create New...