Jump to content

Joan

EstablishedMember
  • Content Count

    25
  • Joined

  • Last visited

Everything posted by Joan

  1. I've send a large e-mailt o Dave some time ago with 4 or 5 ideas , but I've not seen nothing that I suggest to him. Regards; Joan.
  2. Hi All: this simple code doesn't works with 16F84A at 20 MHz: ************************************************ #include char A; main() { disable_interrupt( GIE ); trisb = 0; portb = 0; A=01010101b; while (1) { A = A:D
  3. Why your Compiler can't generate baudrates up to 28 kbps? An XTAL of 20MHz I think it's quite enougth to generate a Baudrate around 700 times more less, but your compile can't do it. Why? I need to generate a Baudrate of 76 kHz with RS232 statement. Best Regards. Joan.
  4. Prefekt: the examples on the web works fine, but try with this code for PIC16F84A at 4MHz. It takes TTL Data converted from a PC->RS232 Interface: #include //RS232 settings #pragma RS232_TXPORT PORTA #pragma RS232_RXPORT PORTA #pragma RS232_TXPIN 1 #pragma RS232_RXPIN 4 #pragma RS232_BAUD 9600 #pragma TRUE_RS232 1 //Timing settings #pragma CLOCK_FREQ 4000000 main() { char data; //Hardware Initialization disable_interrupt( GIE ); set_bit( STATUS, RP0 ); set_tris_a( 0x10 ); set_tris_b( 0 ); clear_bit( STATUS, RP0 ); output
  5. The following codes have only 1 deferent line ... in the first code the line is delay_us(16); in the second code the line is delay_us(15); This code generate a 22.5us Delay #include char num; main() { trisio = 00001000b; // ( Output=0;Input=1 GP5,GP4,GP3,GP2,GP1,GP0) cmcon = 7; gpio = 0x00; num=0; while (1) { gpio = num; delay_us(16); num++; } } This code generate a 12.5ms delay #include char num; main() { trisio = 00001000b; // ( Output=0;Input=1 GP5,GP4,GP3,GP2,GP1,GP0) cmcon = 7;
  6. Solved problem. Changed lines /* The following line used to display in BCD */ PORTB=char_to_bcd(RetrieveData( 0x50, 0, ( num - 1 ))); /* Reads back to port B in BCD*/ /* The following line used to display in hex */ /* PORTB=RetrieveData( 0x50, 0, ( num - 1 )); /* Reads back to port B in hexadecimal*/ for this /* The following line used to display in BCD */ PORTB=char_to_bcd(RetrieveData( 0x50, 0, ( num - 1 ))); /*Reads back to port B in BCD*/ /* The following line used to display in hex */ /*PORTB=RetrieveData( 0x50, 0, ( num - 1 )); Reads back
  7. Hi Dave: I've tryed with the sample code located at the directory C:/.../plugin_examples/bcd_i2c/ And I had and error when building project (Target=16F877 & Clk=4Mhz) like this: EPOMA~1.C i2cmain.c line 84: EOF in comment 1 errors detected Prepocessor error Done Failed I don't have any idea abut that, Do you know? Thanks John
  8. Hi All: I have a question ... I need to implement an I²C with a 12F629, is it possible? I've seen the project wizard and there is some parameters but not for 12F629 ... The functions that create project wizard, which I²C BW generate for an internal 12F629 Clk of 4MHz? A minimum of 100k? It is possible to implement I²C comunication into 12F629 at the same time it's controlling 2 sotfware PWM's? Is PWM consistent? Regards; John
  9. Prefekt: As you know RS232 works with between +9/-9V and +12/-12 V for 0/1 levels, and TTL works with 0/5 V. If you want to comunicate a TTL device (a PIC or uC) with a RS232 device (like PC), you need an RS232 interface. If both are RS232 or TTL you don't need that interface. First of all you need to know which tipe of interfaces you want to interconect (a cheap digital tester or an oscilloscope are util for this porpouse), RS232 remains at "1" level when there is no data to transmit. Second you need to know if there is any kind of protocol for comunication or if you can implement the 8N1 st
  10. Hi Steve; there you have a very simple example to do that. Relays are connected to gpio0 and gpio1, and they are turning one and off once every second (when one is on the other is off). Take a look... #include "system.h" main() { trisio = 00001000b; // ( Output=0;Input=1 GP5,GP4,GP3[input Ever],GP2,GP1,GP0) cmcon = 7; gpio = 0x00; while (1) { set_bit (gpio,0); clear_bit (gpio,1); delay_s(1); clear_bit (gpio,0); set_bit (gpio,1); delay_s(1); } } Best Regards; Joan
  11. Hi uwe; I tried with this code ... (I used it with 16F873 uC) /////////////////////////////////////////////////////////////// #include unsigned char ad_result_0; char cont; 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 M
  12. Hi all; I want to learn how to do an ADC conversion without interrupts form RA0 with 16F873 uC. Exactly, I want to put 8 less significative bits of ADC(RA0) conversion into PORTB once at second. Anybody have an example? Regards; Joan
  13. Hi Dave & CO: I have copied&pasted exactly the code that is on the examples page ( LCD sample application by Victor Golutvin, corrections by David Hobday) and works fine. I noticed that you have put info about connections inside main.h When I said "Do you have done it with MS-Paint or it's a real PicantIde's screenshot ?" .... it was a joke :: Good job ... Good support ... Good Plugin ... Suggestion: when post examples ... please test it before ... Best Regards John :laugh:
  14. Hi Dave & CO: I have corrected all errors you mentioned, but I can't do nothing with LCD Plugin. About the letters on LCD AlphaNumeric Window: "LCD Plugin For PicAnt IDE" Do you have done it with MS-Paint or it's a real PicantIde's screenshot ??? Perhaps I need a code list example that really works (with a good documentation: pinout, schematic, etc ( usually it's a good way to start) ... ). Please, when somebody have a good example (that works) put it on the forum .... Thanx ... :laugh:
  15. Hi all, I'd tried use LCD plugin but I had no luck. I use the example how to control HD44780-based character LCD ( by Victor Golutvin) First time with: main.c, main.h Second time: lcdfunc.c, main.h What I'm doing wrong? Anybody have an example that works with this plugin???? Thanx
  16. Hi all; anybody knows how can I implement 1 sec delay using TMR0 interrupt? Any example? Thanx; Joan
  17. Ted, select 16F84 from "Setting ---> Target ---> 16F84" and try with this code. Next, check with an oscilloscope if delays are correct. #include "system.h" #pragma CLOCK_FREQ 2000000 main() { disable_interrupt( GIE ); trisb = 0; portb = 0; while( 1 ) { portb = 0; delay_ms(250); delay_ms(250); delay_ms(250); delay_ms(50); portb = 255; delay_ms(250); delay_ms(250); delay_ms(250); delay_ms(50); } } Best Regard; Joan :laugh:
  18. // Example to see how to work with gpio bits // In this example we will see how to set & clear only a pin // and how to read only one pin of gpio #include "system.h" #define bitmask_0 0x01 // bitmask_0 = 00000001b #define bitmask_1 0x02 // bitmask_1 = 00000010b #define bitmask_2 0x04 // bitmask_2 = 00000100b #define bitmask_3 0x08 // bitmask_3 = 00001000b #define bitmask_4 0x10 // bitmask_4 = 00010000b #define bitmask_5 0x20 // bitmask_5 = 00100000b #define bitmask_6 0x40 // bitmask_6 = 01000000b #define bitmask_7 0x80 // bitmask_7 =
  19. Hi Daniel & CO; Working with 12F629 and using instructions like [.../...] set_bit( gpio , 0 ); delay_s(1); clear_bit ( gpio , 0 ); delay_s(1); [.../...] works fine, but what about read only a pin ?. I've tryed with a mask but I don't know what I'm doing wrong. Do you know how can I do it?. Perhaps is a obiously answer for this simple question but I don't have any idea ( It is possible that I don't know enought C programation ). Regards; Joan
  20. Hi; How can I set & clear a pin individually when using a 12F629? Thanx; Joan ???
  21. Hi Steve, your program works fine !!! Thanx a lot for your help !!! Best Regards, Joan
  22. When I have a project opened or closed and I try to choose this option: Menu Project --> Wizard... Appears this messange and PicAntIDE 5.00 Beta 1 closes itself: Error: Access violation at 0x15728ED (tried to read from 0x00000020), program terminated. Regards; Joan
  23. When running PicAntIDE 5.00 Beta 1 I have this message: "Cannot find import; DLL may be missing, corrupt, or wrong version File "PropTree.dll", error 126" What's the matter?? Best Regards, Joan
  24. I have this inputs: b = input_pin_port_b(0); c = input_pin_port_b(1); d = input_pin_port_b(2); And I want this output in port_a_pin(0) : E = not( [(not()*(not©)*d] + [b*c*(not(d))] ) How can I implement this function in C2C? Thanks; Joan ???
  25. Anybody can send me or post examples (C2C) for use te PIC16F628 D/A Converter & A/D Converter? Thanx.
×
×
  • Create New...