Jump to content

Paolino

EstablishedMember
  • Content Count

    49
  • Joined

  • Last visited

Everything posted by Paolino

  1. At least you should extract and post a small code, in particular the one that manage the interrupt service routine. I'd like to ask you: do you clear the interrupt flag of the TIMER that goes in overflow? These flags are: - for TIMER 0: t0if or tmr0if - for TIMER 1: tmr1if - for TIMER 2: tmr2if ... Regards. Paolo.
  2. As discussed in this post, it seems that PIC12F series GPIOs are not supported in the IDE. Don't know if it could be a bug, anyway I report it. Bug description: SourceBoostIDE's plugins do not support PIC12F series GPIOs Steps to reproduce: Select, for example, the LED plugin; right button click in the plugin window, select the CONFIGURE... option. The scroll box does not contain GPIOs but only PORTs Expected behaviour: GPIO supported Is the problem 100% reproduceable: Yes IDE version: 6.89 Compiler: BoostC Compiler version: 6.89 Target device: PIC12F675 OS: Win XP PRO and Win XP Home Comments: it seems that all the plugins do not support GPIOs. In fact, same problem appears trying to debug with BUTTON and/or BUTTON BLOCK plugins Best regards. Paolo.
  3. Russ, as you have discovered looking at the datasheet, for PIC12 series the I/O ports are not called PORT such all the other PICs, but GPIO, General Purpose I/O. PIC12F675 GPIO register is mapped to address 0x05, same address of PORTA for PIC16F series. For that reason I decided to try the LED plugin configuring it as PORTA, RB2. I do not think it can be a compiler bug, because the source code is correctly compiled and linked and it works if downloaded onto a PIC12F675. If of ipothetic BUG we can talk, I think it must be found in LED, BUTTON (and other) plugins; the same code I posted, update correctly the status of the register GPIO, if I watch it in the register window. Maybe Pavel and/or Dave can give an answer. I only suppose that PIC12F series can not be debugged with those plugins... :angry: Thank you. Paolo.
  4. Russ, this is the very simple code I wrote: // Comparator module off cmcon=0x07; // ADC module off ansel=0x00; // GPIO TRISTATE config trisio=0x3B; gpio.2=1;//LED = ON; delay_ms(200); gpio.2=0;//LED = OFF; delay_ms(200); while(1); The register window is correclty updated when both "gpio.2=1" and "gpio2=0" instructions are executed, but the LED plugin does not work. That plugin is configured as led connected to PORTA pin RB2, but the led stays off (dark green or dark red). Hope this help. Thank you. Paolo.
  5. Hi guys. I was trying to debug with SourceBoostIDE a simple code written for PIC12F675 with BoostC. A LED is connected to GPIO2 and a button is connected to GPIO5; I found problems to use the plugins LED and BUTTON since I could not assign the GPIO address. I found only PORTx in menus Configure for both plugins... Is this my mistake? Where? Is there a workaround? Thank you. Paolo.
  6. Thank you Reynard, once again! Problem solved reading the GPIO ports before clearing GPIF flag. Great. Paolo.
  7. Hello guys. Here is my code for a PIC12F675: void main() { // comparator off cmcon = 00000111b; //0x07; // ADC module off ansel = 00000000b; //0x00; // I/O TRISTATE config trisio = 00111011b; //0x3B; // TMR0 enabling option_reg = 01000111b; //0x87; // TMR1 enabling t1con = 00110100b; //0x34; // waek pull-up on GPIO4 and GPIO5 wpu = 0x30; // Interrupt-on-change: GPIO4 and GIPO5 ioc = 00110000b; //0x30; // interrupt config set_bit(intcon,GPIE); set_bit(pie1,TMR1IE); // interrupt enabling set_bit(intcon,GIE); set_bit(intcon,PEIE); tmr1l=0; tmr1h=0; while(1); } and this is the ISR routine: void interrupt (void) { // INTERRUPT-ON-CHANGE if (test_bit(intcon,GPIF)) { clear_bit(intcon,GPIF); // do something else... } if (pir1.TMR1IF)// TMR1 OVERFLOW { pir1.TMR1IF=0; clear_bit(t1con,TMR1ON); } } The strange thing, simulated in MPLAB 8.10 with MPSIM, is the following: void interrupt (void) { if (test_bit(intcon,GPIF)) 0032 1283 BCF STATUS, RP0 0033 1C0B BTFSS gbl_intcon,0 0034 2850 GOTO label6 { clear_bit(intcon,GPIF); 0035 100B BCF gbl_intcon,0 ... ... ... 0050 label6 { 004B 1105 BCF gbl_gpio,2 The compiled code does not clear immediately the GPIF flag; it take two consecutive runs in the ISR routine! THe INTCON register value is 0x4D when the interrupt occurs and after, only after, the second run (without exit!!!!) it becomes 0x4C (GPIF is cleared). I am going crazy since I can not figure out why it happens. Could it be a bug? BoostC's or mine? Thank you. Paolo.
  8. Thank you, Dave. I promise I won't use XINT_ON till you have not implemented them I do not want anymore troubles with extended instruction set Cheers. Paolo.
  9. Dear all, I was going mad for the following experience which I share with you, maybe someone can find out the reason. Simple project: I needed to drive a 2x16 LCD and included lcd_driver.h. The PIC is a PIC18F2520, so I took care with PORTB analog settings, since PORTB is used to drive LCD. The PIC correctly runs with its internal RC-oscillator, at 8MHz. The problem comes out with a CONFIGURATION BIT: I decided to use the extended instruction set of that PIC, so I wrote: #pragma DATA _CONFIG4L, _STVREN_OFF_4L & _LVP_OFF_4L & _XINST_ON_4L & _DEBUG_OFF_4L but the LCD did not show anything! I explored all the possible roads: hardware fail, wrong connections, oscillator configuration, etc. Then I decided to try to switch-off the extended set instruction: #pragma DATA _CONFIG4L, _STVREN_OFF_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L and the LCD works! I can not figure out why, maybe Pavel and/or Dave can give us a good explanation of that trouble. Thank you. Paolo.
  10. Reynard, I have optimized the DS1302 routines and now they work also if I compile them with BoostC V.6.85 I tested them also with PIC18F252 and I got no problems. Best regards. Paolo.
  11. Dear all, I am going to use the float.h and float.pic18.lib files. Since I am going to calculate floats and I need to represent them on a LCD display, I have only one idea to work-around the missing "%f" in the lprintf format; I multiplicate the float variable by 10 (for example, needing only one decimal digit), convert it into long variable and then calculate the integer part (with sign) and the decimal of that long variable. That should give me more possibilities to show a float-to-long variable on LCD... Any other ideas? Thank you. Paolo.
  12. Ooops, I do not think so! I did not do that and probably that is the reason of my troubles... Anyway, I'll check asap and if not included I will include the libc.pic18.lib library and I will make a report, but I think that the problems will go away. Thank you to have given me the direction to follow. Paolo.
  13. Project conditions: - PIC18F252 - BoostC full license - BoostC V.6.84 - MPLAB 8.01 When I compile the project in SourceBoostIDE it works, but when I compile the project inside MPLAB, I have the following problems with the linker:: BoostLink Optimizing Linker Version 6.84 http://www.sourceboost.com Copyright© 2004-2007 Pavel Baranov Copyright© 2004-2007 David Hobday Optimisation level:1 Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external function:'__div_32_32(unsigned long,unsigned long)' Error: Unresolved external symbol, function:__div_32_32 failure BUILD SUCCEEDED: Wed Apr 02 07:56:58 2008 And MPLAB gives a popup window with the message "Failed to load FILENAME.cof" I suspect that the problems come out from this function, but I can not figure out why: void pressure (void) { unsigned int adc_value=0; unsigned long c; unsigned long Pr; char k; adc_value=adc_measure(PRESSURE_SENSOR); k=1; c=(((unsigned long)adc_value)*128)/200; k++; } If I comment the line that calculate the variable c, the problems disappear... Where are my mistakes? Thank you. Paolo.
  14. Dave, thank you for your prompt reply. I've checked the code I wrote to manage DS1302; in that part of code I only use nop(); or nop(); nop(); to introduce a small delay. The PIC has an oscillator of 10 MHz and it runs at 10 MHz: the PLL is turned off. Any other ideas? Thank you. Paolo.
  15. Dear all, my project uses PIC18F4620; on board I have also the real time clock DS1302 interfaced with the PIC. I began that project with BoostC 6.82. Now, the problem is that if I compile it with 6.84 or previous, the RTC is correctly interfaced and I can read the clock running on LCD; if I install and compile the same project with BosstC 6.85, the RTC seems that does not start! I can not understand if some new optimizations of ver. 6.85 can introduce these behaviuor differences. Have you some tips 'n trikcs that must be taken into account with ver. 6.85? Thank you. Paolo.
  16. Dave, I am going to write down a library with a free pin assignement. I mean, I need to drive a clock signal out from the PIC and I would like that pin to be RA3. For instance you could use the same library I wrote, but due to you hardware desing you need to drive the clock signal out from RB5 (the same can be done also for inputs) How I can do it? How can I "teach the library" that the pin is not static but it can be assigned by the library user? How can I manage TRISx and PORTx, leaving the freedom to assign x to a not pre-defined port? Thank you. Paolo.
  17. I have been using the suggestion got from teejaydub: it works! Thank you! At the moment, I have not used the -icd2 linker option, but just the -rt 0x700. In the next few days I will try with -icd2 and also with a PIC18F, and will let you know. Regards. Paolo.
  18. Thank you, Manuel. I will try and I will let you know. Regards. Paolo.
  19. Here I am again. I tried a very simple firmware for a PIC16F819. The project is compiled and linked into MPLAB IDE 7.62. I have no problems when I do not use ICD2 as debugger. When I decide to use it, I #include <icd2.h> and put "-rt" option in the linker edit window. The output is the following: What's the problem with my setup? Are there other tricks I do not know? Thank you for help. Paolo.
  20. I would like to know if BoostC supports pointers to function; are there any limitations or not? Thank you. Paolo.
  21. You are welcome! Very good that you solved that problem. Ciao. Paolo.
  22. I agree with you: it should work! I just ask you to check something else: - the maximum current sourced/sunk by each pin is 25mA: do you exceed RB4 current? - the maximum current sourced/sunk by each port is 200mA: do you exceed PORTB currrent? - is broken the resistor connected between RB4 and its led? - have you tested the presence of +5V on RB4 pin (even though the led is off)? Let us know. Paolo.
  23. You need to specify in you code: adcon1=0x0C; // To have only AN_0, AN_1, AN_2 configured as analog input, Vref=Vdd, Vss=GND and in the configuration bits word, disable PBADEN, as follow #pragma DATA _CONFIG3H, _PBADEN_OFF_3H It should work. Then, trisa, trisb, trisc, must be set depending on your needs: some bits must be put to '1' (specify INPUT mode), other will be at '0' (OUTPUT mode). Check the device datasheet for more details. Regards. Paolo.
  24. The code you posted is correctly compiled. Are you sure you have not deleted any paren somewhere? Check the code before the "for" cycle. Regards. Paolo.
×
×
  • Create New...