Jump to content

Reynard

EstablishedMember
  • Content Count

    688
  • Joined

  • Last visited

Everything posted by Reynard

  1. You have fell into the standard trap of not setting the ADCON1 to turn the default analog inputs into digital inputs. Try adding adcon1 = 0x0f when initialising. Cheers Reynard
  2. Hi Sudhi, If you have told MPLAB you are using ICD3 as a debugger then perhaps it is automatically changing your config bits to suit the working environment. Try setting the debug tool to None or Simulator and see if it stops changing your config bits. RB6/7 will not work if the hardware is in ICD mode due to MPLAB. If you are using ICD remember to tell BoostC about it. See ICD2.h file it may work for ICD3. Cheers Reynard
  3. Hi Sudhi, portb.RB6 = latb.RB5; Here you are reading the output latch register and not the port input pin. Cheers Reynard
  4. Hi Matt, If you don't specify config bits, SourceBoost tends to set them to '1'. Although you have only specified _OSC_HS_1H in CONFIG1H, you also have FCMEN bit set which enables the failsafe oscillator to kick in should the HS oscillator fail which is possibly what you are seeing. Also make sure the extended instruction set is NOT enabled if you change CONFIG4L. Cheers Reynard
  5. Nice solution. I didn't spot that in the manual for consecutively addressed register pairs. Always learning. Regards Reynard
  6. Hi Mac, Although ccpr1 is a 16 bit register, it is formed using two 8 bit registers ccpr1h and ccpr1l. You have to load both bytes individually. You could write a macro to make it look like a 16 bit value you were loading. These are afterall 8 bit processors. Cheers Reynard
  7. Hi Mike, Try adding this to your code. //Enable Peripheral interrupts set_bit (intcon,PEIE); Cheers Reynard
  8. Hi Mike, Note that the A/D requires a settling time before you start the conversion. This is to allow the sampling capacitor time to charge up or down to the input voltage. This settling time is after you turn on the A/D and after you do a channel change. Cheers Reynard
  9. Hi Bob, I understand now that you are using the simulator. How exactly are you measuring time ? The IDE simulator only shows "Ticks" which is oscillator cycles. It will not matter what IDE frequency you choose as there will be a fixed number of cycles for a given pragma value for the delay function at compile time. If the pragma is set for 4MHz then it will take 3906k Ticks for the 1 second delay function. If you set the IDE to any frequency it will still take 3906k Ticks for the delay function, but in calculated real time depending upon the IDE frequency, it could be any time value. Maybe I still havn't grasped what you are saying here. Cheers Reynard
  10. Hi Bob, When you change the clock rate setting of the IDE and/or #pragma, are you also changing the frequency of the PIC oscillator as well ? Remember: the compiler does not change the operating frequency of the PIC hardware. The compiler has two fequency settings. The IDE setting and the #pragma setting. One will superceed the other. I suspect if there is a #pragma CLOCK_FREQ specified it will superceed the IDE setting. You can do without the #pragma and just use the IDE setting alone but the #pragma make a good comment line about what you think your target PIC is running at. Cheers Reynard
  11. Hi Martin, Good to read you got it going in the end. I find it a bit odd that the frequency was so far out. These devices are suppose to be factory calibrated to 8Mhz with an osctune value = 0 (reset default). Cheers Reynard
  12. That's a minor detail. The ST7036 data sheet give sample code of how it is done. Cheers Reynard
  13. You could try the SourceBoost lcd_driver.h code. The DOG display driver chip says it is HD44780 compatable. Cheers Reynard
  14. Hi Shree, If you have multiple interrupt sources you will have to poll the interrupt flags that you have in use to see which one(s) are wanting service. void interrupt (void) { // Poll to see who interrupted. if (intcon.T0IE && intcon.T0IF) // was it timer0 ? { ... Timer 0 code here. intcon.T0IF = false; // Reset interrupt flag. } if (intcon.RABIE && intcon.RABIF) // was it port B change ? { portBdata = portb; // Read port to clear mismatch. ... Port B code here. intcon.RABIF = false; // Reset interrupt flag. } } This code qualifies the interrupt to check if it enabled and if the interrupt flag is set. Qualifiying is not alway necessary if you have interrupts always enabled. But it is good practice I think. If your PIC supports high and low priority interrupts, then you could put one interrupt on each. Cheers Reynard
  15. Hi Martin, The problem with your display is that you are not multiplexing the digits. You will have to uodate your output with a new digit and select say every 2-5ms. I am able to echo back to HT with no problems. Cheers Reynard
  16. Hi Martin, If you have a scope then pin 3 should have a 2MHz squarewave on it. This confirms that Fosc is running at 8MHz. I have tried your code using a PIC16F687 (as close as I could get to a 690) and sent out a 0x55 byte. My scope confirms a baud rate of around 9625 which is close enough. Your problem lies elsewhere. Cheers Reynard
  17. Hi Martin, The #pragma CLOCK_FREQ does not set your clock frequency for the PIC. The pragma is for the compiler to use internally in order for it to calculate build in functions like delay_ms() correctly for your operating frequency. Note also that the delay_ms() function only takes an unsigned char as an argument therefore your value of 500 will only be around 244ms. If you turn on all warnings the compiler will tell you this info. Cheers Reynard
  18. The problem is possibly in the V6.92 that you are using which had problems with sources from multiply locations. Upgrade to V6.95. Cheers Reynard
  19. Mmmmmmmmmmmmm! Upgrade to BoostC 6.95. Alternatively copy all the USB library files into the application/project directory. Cheers Reynard ps. See version log V6.93 RC2
  20. Open up the project usb_serial.__c within the IDE. The "Workspace" panel shows you all the files needed and where they are (directory). Where the pic_pack library files are depends on what you done with them when you unzipped the files. I just opened up the project, hit the 'B' button and it all worked. Look at the Settings/Options... dialog box for extra compiler option. Cheers Reynard
  21. Hi Raghunathan, These are just test file for some of Ian's projects so you can ignore them. Visit Ian's web site http://embeddedadventures.blogspot.com/ and goto USB Part 5 and it tells you a little about a file for TechToys demo board. Cheers Reynard
  22. Hi Raghunathan, The fact that config.h is included twice does not matter. This file has conditional compile flags so it will only be included once. The system files "string.h" are in double quotes but do not have to be. It could have been written as <string.h> and still compile OK. The double quotes says "Look in the project directory first, if not found look in the system ..\inc directory. The demo does compile with a few warnings which could be sorted with a few casts etc. Cheers Reynard
  23. Shree, Pick-a-PIC (sorry) that has at least an 8 level stack. Devices with only a 2 level stack are possibly not suited to high level languages like C. Cheers Reynard
  24. Hi Ian, The Standard version is limited in ROM size but unlimited in RAM size. See the wab page: http://www.sourceboost.com/Products/BoostC...imitations.html It details the license limitations. I have the Full version from Maplin and all works unlimited. Cheers Reynard ps. I agree if it says code size unlimited on the box then thats what you should get.
  25. You are diong assignments outside of a function block. Put your register assignments inside main() or some initialisation function. void main(void) { intcon = 0xE0; t0con = 0X87; tmr0h = 0x03; tml0l = 0x09; ... } Cheers Reynard
×
×
  • Create New...