Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by Prefekt

  1. Hi, my code for adc with the PIC 12F675 works fine with C2C. But now I have the SourceBoost and the compiler tells me, that are any errors in my code. But I cant find any errors... Here is the part with the ADC /*- Variablen ------------------------------------------------------------- */ char ADCon0@0x1F; char ADCon1@0x9F; char ADResH@0x1E; char ADResL@0x9E; short sResult; // 16Bit ADResH & ADResL /*- Config ---------------------------------------------------------------- */ //option_reg; trisio=001001b; //cmcon=7; /*- Am Anfang den Port ausschalten und
  2. Hi, I use the PIC12F675 or PIC 12F629 for this. Do you have an sample code with the timer? regards, Volker
  3. Hi, I want to meassuring the high pulse of an frequency. The high puls could be between 0,5 and 2ms and I need the excacly worth of the high pulse time. Has anybody an Idea how to meassure frequency and/or the hight pulse time? thanks Volker
  4. Hello, here is my code to work with the eeprom. #include <system.h> //the memory bank 0 should be selected void write_flash( char addr, char data ) { //Write flash eeadr = addr; eedata = data; set_bit( status, RP0 ); set_bit( eecon1, WREN ); eecon2 = 0x55; eecon2 = 0xAA; set_bit( eecon1, WR ); while(eecon1&2); clear_bit( eecon1, WREN ); clear_bit( status, RP0 ); } char read_flash( char addr ) { //Read flash eeadr = addr; set_bit( eecon1, RD ); asm movf _eedata, W } With a little test p
  5. Hello, I'm stored values in the internal EEPROM from a 16F876. After a reset are the values sometime corrupted oder the values are not the same. Somtimes after a reset, the values are ok? Can anybody explain me why and how I can store my values right in the internal EEPROM? Thanks Volker
  6. Hello, I'm thinking also, that is as memory problem. Sample Variable definition: it work's: char a; char b; char c; or int i; or int i; char a; it dosen't works: char a: char b: char c: char d; or int i; int j; or int i; char a; char b; Here is a sample Code, that work. If you delete the comment and use the two integer variable it doesen't work.... #include <system.h> void erase_eeprom(); void write_eeprom(char adresa,char data); char read_eeprom(char adresa); void main(void) { char c=0x00; char d=0x00; char a=0x00; char e=0x00; ch
  7. Hello, I'm using a 16F876 and the internal eeprom. The write and read at the eeprom works fine. But if I'm using more than three variables like this: char cDigit1=0x00; char cDigit2=0x00; char cDigit3=0x00; char cDigit3=0x00; the value was not written in the eeprom? If I wrote this in my code: char cDigit1=0x00; char cDigit2=0x00; char cDigit3=0x00; //char cDigit3=0x00; it works? my eeprom code is: void write_eeprom(char adresa,char data) { char addr = adresa; char dat = data; asm{ BSF STATUS, RP1 ; BSF STATUS, RP0 ;Bank 3 BTFSC EECON1, WR ;Wai
  8. Hello, where can I found an simulator for the pic? Thanks Prefekt
  9. @Joan: Thank's, this was very helpful... @All Has anybody code for a serial connection? The examples on the example page dosn't work! Thanks Prefekt
  10. Hello, I've a Transponder Board that implements a RS232 Interface. This Borad I can connect with my PC and I developed a software the can comunicate with the board. Now i would like to get the information from the board with a pic. Need I a serial interface IC? Has anybody a shematic and the C2C Code for a example application? thanks regards Prefekt
  11. Has anybody implementet an DCF77 receiver with a pic? cu Prefekt
  12. Hello, I've problems with the A/D conversation. When I'am using only AN0/RA0 it works fine. But, when I'm using AN0 and AN1, the value on AN1 is correct, if AN0 has no input. If AN0 and AN1 have Input, the messuring on AN0 is ok, but the messuring on AN1 is incorrect. And anoterh probelem is that i configure trisa = 00000001b; if I write trisa = 00000011b; the A/D converter is not running but I'm using AN0 and AN1 why? here's the configuration: trisa = 00000001b; ADCon1 = 10000100b; ADCon0 = 01000001b; That's the code to messure AN0: void MessureAkkuVoltage() { /*
  13. Hello, I've a simple question about the porta. I've making six LED's on the porta of a PIC16F876. The code is the follow: trisa=00000000b; porta=00111111b; On the output, the LED 1,2,3,4,6 are on, but the LED 5 (RA4) is off, why? Regards Prefekt
  14. Hello, the sampel DS1302 RTC dosen't work, why. I've mailing the author Don Cramer, but no answer is comming... The only change I made is: rst_pin = 0 on porta clk_pin = 1 on porta data_pin = 2 on porta an i have the output from the rtc display on LED's. Has anybody use the code or have a nother code for the ds1302? thanks
  15. Hello, I programming a LCD Interface an a ADC Input. Now I would display the voltage from ADC to my LCD Display!. But I have two values, one in the low byte another in the high byte. How I can convert the binary value to a decimal value? Also I think, I must compute: U = Uinput * 5 / 1,024, because the pic can messure 5V with 10Bit (1024), so the PIC can messure 2,8828 mV Steps 5V/1024, right? Has anybody implimented a voltage messure and display on a LCD? Thanks Volker
  16. Hello, I want to get Analog input information. Has anybody implemented a Analog Inpuf for the e.g. PIC16F876? Thanks Prefekt
  17. Hello, I mean I am getting the wrong duty cycle! Do you have any idea? Is a PIC 16F876 with 4Mhz ok, or should I get a PIC with 20Mhz? Prefekt
  18. Hello, I need a PWM Output on 10 Pins. Do anybody write a PWM output on variouse pin's? I wrote the folling code: while (j <= 4) { while ( i <= 255) { set_bit(portb, 1); delay_us(200); clear_bit(port. 1); delay_us(55); i=i+1; } i=0; j=j+2; } This code shoud genertae a output frequenze, with e.g. 1Khz with a output for 72,5%on an 27,5%off. But the output is not so, why? thanks Prefekt
  19. Thank, it's so simple, but i had no idea... Regards Prefekt
  20. Hello, I'm new in programming PIC with c. In one of my first project, I want get information if a spezifield bit is set on input porta e.g. bit 2. The function input_pin_port_a() is obsolet? Is ther a new function? Ther is the function set_bit(). May problem is, I have definition trisa = 00001100b; Then i want call a function if porta is xxxx01xxb and xxxx10xxb (x is 0 or 1) How I can do that without to write: if (porta == 00000100b or porta == 00000111b ...) ? thanks Prefekt
  • Create New...