Jump to content

DavidT

EstablishedMember
  • Content Count

    60
  • Joined

  • Last visited

Everything posted by DavidT

  1. I found the technique in post 1 of this link to be helpful in storing large amounts of data. In my case I strung together 10*256bytes on an 18F. http://forum.sourceboost.com/index.php?showtopic=3660 David.
  2. Hi. If you are using normal servos then they will be expecting a pulse of between 1 and 2ms every 20ms. I'd guess your two controls are aileron (or rudder) and elevator. They don't need to be operated exactly together so you can simply make servo1 go high for between 1 and 2ms then low, then do the same for servo2. Then wait about 17ms and start again. The 1-2ms is important but the 20ms timing is not. You might be able to do this with delays, or otherwise just wait for a 16bit timer to reach appropriate values before making ports high/low. If your motor control is via a commercial electro
  3. Thanks. I think Pg65 of BoostC pdf in 6.91rc3 needs updating. Regards, David.
  4. I use the approach in post 7 but with reference diodes instead of zeners. These can be extremely accurate. Farnell sometimes have them in 10v although 5v and less are more common. I have 2 examples on my site. Follow the 'back' button at the foot of both pages. This will take you to a circuit description which explains how I use them. http://www.flyelectric.ukgateway.net/bal3-cct.htm http://www.flyelectric.ukgateway.net/lithtester2-cct.htm Regards, David.
  5. Thanks Reynard. I normally typedef u8 as char and 'volatile u8' seems to work. Cheers, David.
  6. Should I be able to do this? Compiler gives error (v6.90): Regards, David. typedef volatile unsigned char v8;
  7. I can't keep up :-) Thanks for the regular updates. Regards David.
  8. This seems a useful way of creating large arrays but the bug does not seem fixed in v6.89. Overlooked perhaps? Regards, David.
  9. The uitoa_dec function in this design may help you http://www.flyelectric.ukgateway.net/pic-lcd1.htm David.
  10. I'm not sure if PicKit2 does low voltage programming but it definitely does high voltage (the manual refers to a 12v Vpp). No mods are needed to the programmer. The config I gave you works perfectly on a default install of PicKit2. It is normal to link the Pic's MCLR pin to Vdd with a 10k resistor to prevent a floating input and random resets. While you are struggling, make sure nothing else is connected to the MCLR, PGD or PGC pins as extra circuitry can interfere with programming, especially the clock pin. dt.
  11. I've used the following successfully on a 16F88 (when looking up these settings in the data sheet note that Fosc uses bits 4, 1 and 0; can be confusing): #pragma DATA 0x2007, 0b11111101010000 //Config1 #pragma DATA 0x2008, 0b00 //Config2 I recall reading about a special low voltage setting which can be used to recover Pics. You'll need to troll through some of the posts: http://forum.microchip.com/tt.aspx?forumid=15 David.
  12. DavidT

    V6.85rc

    An old project would not compile. Displayed "Building..." at the bottom and nothing else. I installed it to a '685' folder and my previous version was to a '683' folder. When I looked at Settings/Options/Tools the Compiler&Link Directory field had defaulted to C:\Program Files\SourceBoost683\ I've had to change this manually to my new directory. I don't remember having to do this before. David.
  13. I time or debounce push-button presses in interrupts with this: for(i=0; i<100; i++) nop(); Regards, David.
  14. 1. Can you create a list of 'favourite' devices perhaps at the top of the Target drop down list. I'm sure most of us use a very small number of devices. 2. To maximise the size of the main editing panel, can you reduce the rows taken to display key messages at the end of the Output window. I like to see the 3 'Memory Usage Report' rows but would then like one more row that says something like "Successful but with 'x' warning messages/'y' errors". I then know whether to scroll up or not. 'Done' is redundant I think and the empty rows at the end are waste of space (empty rows higher up a
  15. The comparators can make ports toggle so it's also worth switching them off. I'm normally specific with my analogue/digital config. David. ansel = 0; cm1con0.7 = 0; cm2con0.7 = 0;
  16. Yes, very much like what I have in mind. A quick test with the first suggests the compiler won't accept it though. I'll experiment a bit more tomorrow. David.
  17. Thanks, this gives me more function orientated approaches and improvements. Is there any way to use an array or bits in a variable with each representing LED ports? I would like to switch the LEDs in a loop such as below. I can go with a function if necessary; I would just prefer to avoid the code overhead it seems to impose. David. if(i=0; i<3; i++) { led_function(i,1); //Switch LEDs on via function led_array[i]=1; //Use an array? set_bit(led_variable,i); //Bits in a variable? }
  18. Hi folk, I would like switch LEDs and FETs on and off in loops. I can define them individually but then I have to specify each every time. I can also set up a function and call that (see below) but this seems to increase code size. Are there better ways please? Thanks, David. void led (char num, bit state) //Function to switch LEDs //'num' is LED number //'state' is 1=on, 0=off { if(num==1 && state==0) portc.4=0; //LED1 else if(num==1 && state==1) portc.4=1; else if(num==2 && state==0) porta.5=0; //LED2 else if(num==2 && state==1) port
  19. rom char *your_array_name = { 0x01, 0x02, 0x03 }; your_array_name[1] holds 0x02. char type only, max 256bytes per array; see manual for more examples. David.
  20. I'm storing mine in multiple arrays all <0x100, usually in program memory using the rom command. One parameter in my 'font' function selects the array (eg: 1=numerals, 2=upper, 3=lower case) and the other the first offset for the character. You can see how I've done it in my Eratic F18 post. David.
  21. Setting each of the 5 log arrays to a fixed address at the start of separate ram banks (eg: @0x100, @0x200, etc) also appears to make it work. David.
  22. I've written a program to measure individual cells in a pack and display graphs on a graphic LCD. I'm using an 18F2523 and BoostC 6.81. I want to perform 96 measurement cycles and am storing these ultimately in 5 fairly large arrays (log1-5), 1 for each cell. When these arrays and the code that populates them (in main and log_highlow) are where I have them in the code below, the PIC is unstable. By this I mean it either works as expected, displays nothing, scrambles some or all characters, responds to interrupts or not, etc. Packs with different voltages yield different behaviour. When I comme
  23. 1. The easiest is to store data in normal RAM using variables or an array. 2. However, I suspect you are referring to program memory (ROM) which can be written to when programming with the BoostC 'rom' command and read at any time. 3. If you want your PIC program to update this data on the fly you need to have a device which supports 'self-write' ('Enhanced Flash' versions in the 16F series or available in most or all? 18F's). Harder than 1 or 2. 4. External memory will be more work than 3. David.
  24. Hi, The following code is intended to populate EEPROM to confirm that the PIC is working. When I use delay_ms(1) at 8MHz it populates the first three bytes of EEPROM as intended. When I use delay_s(1) at 8MHz EEPROM does not get populated. When I change the clock to 4MHz delay_s(1) EEPROM gets populated. So there appears to be a problem with delay_s(1) at 8MHz. I'm using an 18F2523 with IDE 6.81 on XP. Thanks, David. #include <system.h> //Core configuration (rest left at default): #pragma DATA 0x300001, 0b1000 //Config1H: Internal oscillator with IO on RA6 and 7 #pragma D
  25. I can't guarantee that the following code will work but I've tried to extract the relevant parts from a project of mine: David. #include <system.h> #pragma DATA _CONFIG, _FCMEN_OFF & _IESO_OFF & _BOR_ON & _CPD_OFF & _CP_OFF & _MCLRE_OFF & _PWRTE_ON & _WDT_OFF & _INTOSCIO #pragma CLOCK_FREQ 4000000 #define rs portb.4 //Register Select #define en portb.5 //Enable #define data portc //Characters or instructions for sending to LCD //Assume RW is permamnently low void main(void) { //Initialise all ports porta=0; portb=0; portc=0; //Main port
×
×
  • Create New...