Jump to content

Picxie

Moderator
  • Content Count

    277
  • Joined

  • Last visited

Everything posted by Picxie

  1. For actual details on using the PWM to control a motor you would probably be better off looking at some of the amateur robotics (Robot Wars!) type websites. Pic manuals can be somewhat confusing due to the multifunction of the hardware. The PWM controlled by Timer 2. The Timer2 module has an 8-bit period register, PR2. Timer2 increments from 00h until it matches PR2 and then resets to 00h on the next increment cycle. When Timer2 matches PR2(in PWM mode) it sets the PWM out pins to 1. It also can generate an interrupt but you may ignore that if not required. So timer 2 and PR2 set
  2. The PIC device programming specifications do allow the EEPROM and program memeory to be programmed seperately. It all depends whether your programmer impliments this.
  3. That's strange because in the BoostC Reference Manual (page 42) it says: "Arrays can have any number dimensions" So there's no way to do such lookup table in BoostC ? Anyone some ideas ? <{POST_SNAPBACK}> Sorry, my partial mistake the exact quote from the manual is Arrays can have any number of dimensions. The only constraint is that an array must fit into a single RAM bank. ie , ok for arrays of variables but not for arrays of rom data. Maybe Dave or Pavel could confirm this.
  4. BoostC does not support multi-dimensional arrays.
  5. Sorry no, you are going to have to tell us what the problem is.
  6. You also need to set the device configuration correctly, like oscillator type, disable watchdog etc. Take a look at some of the supplied BoostC sample programs and go from there. Regards Dave <{POST_SNAPBACK}> Picxie, How do you change it to digital ports? <{POST_SNAPBACK}> Read page 128 in the data sheet.
  7. You should consult Microchips datasheet on this device http://ww1.microchip.com/downloads/en/DeviceDoc/39582b.pdf On reset PORTA pins are assigned as analogue inputs for the ADC, its not just a matter of clearing the required TRISA bits, you have to unassign the port bits you equire. This is set in ADCON1. See page 128 in the datasheet for further details.
  8. Its not usual to put code in headers. I bet if you took all that code out of the .h files and put it in .c files your problem will disappear
  9. Also be aware of hidden calls, for instance BoostC uses a call to access a table in program space, other hidden calls are possible if you use multiply or divide operations.
  10. C has two shift operator << and >>. eg x = y << 3; // y is left shifted 3 bits , the result is stored in x. z = w >> t; // w is right shifted according to the contents of t, result stored in z beware wrong y<<2;// y is shifted left two places but the result is not stored so y stays the same correct y = y << 2; note that zeros are always shifted in, there is no arithmetic shift You should consult a C manual for more detail
  11. Ra68qi has a tutorial thread which is probably going to be a good starting point. You can find it at http://forum.sourceboost.com/index.php?showtopic=2399
  12. the duty cycle is set by CCPR1L and CCPR1H for pwm 1 and CCPR2L and CCPR2H for pwm 2. As far as I can see they operate independantly at the same frequency, though I have never run both, so I cant confirm it.
  13. Use a bit mask and shift the mask eg mask = 1; if (byteundertest & (mask << numberofshifts) !=0)
  14. If the PIC you are using has only 1 or 2K of code space than increasing the compilers code max will not make the code ft the device. What device are you using?
  15. (* VS_GUARDEXPR_TYPE) (VS_VOID) is a definition for a function pointer. Sourceboost does not support function pointers.
  16. The limiting factor is the size of program memory (and data EEPROM) for the device you are using. The PIC16F877 has 8K of program words and 256 bytes of EEPROM. The hex file uses 2 bytes to represent a program word so the largest hex file would be have 16K bytes of program 256 bytes of data and probably 1 byte of config. The file's physical size will be slightly larger due to additional information that the hex file format uses.
  17. BoostC18 seems to use only FSR0 and INDF0 for indirect accesses. Copying indirect source to indirect destination would be greatly optimised by using FSR0 as the source and FSR1 as the destination. whilst on the subject. FSR2, INDF2 could be used during the interrupt thread so that FSR0 and INDF0 would not need saving and restoring during interrupt. If you don't use FSR1 for indirect destination operations it could be used for the low level interrupt.
  18. Emte, I don't know what your expectations of the internal CAN interface are but I guess it pretty low and based upon experience of other serial PIC peripherals:) The Microchip guys have done a good job (for a change) with CAN interface, it does all the work of filtering and buffering and requires very little processor overhead once set, up consider it more of an MCP2515 conjoined twin. However... the documentation supplied for the PIC18F2680 CAN is overwhelming (particularly for a CAN virgin) due to the complication thrown in by eCAN, it would be easier on the eyes if it was split i
  19. I dont think any of these are valid optimisations with BoostC. BoostC performs additional optimisations on shift operations.
  20. The on board CAN controller fitted to the PIC182680 when used in legacy mode is surprizingly similar to the MCP2515, if you ignore the windowing system for relocating buffers int base RAM it is in fact easier because you dont have the overhead of SPI comms. Unlike the MCP2515 There is no RESET instruction (the processor reset does that!) All you need to do to set up for standard (Not extended) legacy is Request config mode When config granted (should be immediate) Set up the three control register for setting the bit period (follow the example for the external CAN) Set the TX r
×
×
  • Create New...