Jump to content

uwe

EstablishedMember
  • Content Count

    9
  • Joined

  • Last visited

Community Reputation

0 Neutral

About uwe

  • Rank
    Newbrie
  1. Hi Stringer, this can be done by the script files in the script directory. There are files with the ending *.pat . You would have to add your line of code to the insertion section of the _interrupt_code. There is more documentation on it in the text file about scripts. Regards Uwe
  2. Hi Joan, Hi Dave, I use this function on PIC16F873, PIC16F876(A) and PIC16F877 and it works fine. I also tried the code you posted on a 16F876 on the board that came withe ICD1 debugger and it runs. There are 2 differences to your code : 1) i have included the 2) I had to use portb for the AD result because the LED's are on portb Have you got a bord to test with ? Regards Uwe
  3. Hi all, I need to measure time/frequncy with timer1, but the results I get seem to be nonsens. Does anyone see my mistake ? this is the initialisation: void TMR1_IRQ_EN (void) { disable_interrupt(GIE); clear_bit(intcon, PEIE); t1con = 0x30; /* Timer 1 prescale 1:8, int. clock, TMR1 off */ ccp1con = 0x05 ; /* Capture every rising edge */ set_bit(intcon,PEIE); set_bit(t1con,TMR1ON); enable_interrupt(TMR1IE); enable_interrupt(CCP1IE); enable_interrupt(GIE); } ... and here is the part of my IRQ handler: if (test_bit(pir1,CCP1IF)) // TMR1 Input Capture Interrupt { // clear_bit(pie1,CCP1IE); tm1_val = 0; tm1_val = ccpr1h; tm1_val = tm1_val << 8; tm1_val = tm1_val & 0xff00; tm1_val = tm1_val + ccpr1l; ccpr1l = 0; ccpr1h = 0; clear_bit(pir1,CCP1IF); // set_bit(pie1,CCP1IE); } Any ideas ?
  4. Hi Joan, this is my function to read ADC in polled mode: unsigned char Read_ADC_8(unsigned char ADC_Ch) { adcon1 &= ~0x80; /* ADFM left justified */ adcon0 = (ADC_Ch << 3) + 01000001b; /* Selecting ADC channel Enable ADC*/ delay_us(100); /* Aquisition time */ adcon0 |= 0x04; /* Staring the ADC process */ while(adcon0 & 0x04) {;} /* Wait for conversion complete */ return (adresh);/* Return 8 MS-Bits of the ADC process */ } In the main loop it is called like this: ad_result_0 = (Read_ADC_8(0)); Now you just have to store ad_result_0 in portb. I hope this will help ..... Regards Uwe java script:emoticon(':laugh:')
  5. Hi Joan, this is my function to read ADC in polled mode: unsigned char Read_ADC_8(unsigned char ADC_Ch) { adcon1 &= ~0x80;/* ADFM left justified */ adcon0 = (ADC_Ch << 3) + 01000001b; /* Selecting ADC channel Enable ADC*/ delay_us(100); /* Aquisition time */ adcon0 |= 0x04; /* Staring the ADC process */ while(adcon0 & 0x04) {;} /* Wait for conversion complete */ return (adresh); /* Return 8 MS-Bits of the ADC process */ }
  6. Hi, even if I like the Pic-Ant IDE very much I sometimes miss to start the compiler directly from MPLAB. With MPLAB v6.22 it is now possible to integrate a ' Third Party Tool ' via .MTC files into MPLAB.
  7. Hi Kaplah, take a look at the examples here on the homepage. At the bottom of this section you will find the links to the page of Julian Winpenny. Your 16F874 is code compatible to the 16F877, only RAM and FLASH of your device is less. Regards uwe
  8. Hello Pavel, as you told it was working on w98 I tried, too. On w98SE it works but not on w2k or XP PRO. I tried installing my PicAnt into c:\programme\c2c (German windws) and to c:\Program Files\c2c always as offered from the installation and tried out the other after uninstalling . If there is an old version the links in the desktop and start menu are not updated. uwe
  9. Hello, on my system with c2c v4.5.4e / v4.6e the scripts don't work at all. I am running PicAnt under windows 2000 SR2 with MPLAB 6.10. As described in the text file in the Scripts folder I renamed the piccont4.pa1 to piccont4.pat and expected to see the context saving and restoring code in the asm file but there is still the following code: ORG 4 ;;;;;;;; ;;;;;;;;void interrupt( void ) _interrupt _interrupt__code clrf PCLATH It doesn't matter if the checkbox for enabling context saving in the options is enabled or not. After that I tried to set the debug flag in the script files. I now expected to see the script name in the compiler output window , but there was only a message about the optimazation. Does the compiler search for scripts automaticaly or do I have to enable this somewhere ? Can anyone help ? Thanks in advance uwe
×
×
  • Create New...