Jump to content

Joan

EstablishedMember
  • Content Count

    25
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Joan

  • Rank
    Regular

Contact Methods

  • MSN
    John
  • ICQ
    0
  • Yahoo
    John

Profile Information

  • Location
    Barcelona (Spain)
  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_port_a( 0 ); output_port_b( 0 ); while(1) { dato=getchar(); PORTB=data; } } Regards; Joan
  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; gpio = 0x00; num=0; while (1) { gpio = num; delay_us(15); num++; } } I use a 12F629 with internal 4MHz clock. Why is the compiler generating 2 different frequencies? Regards; Joan
  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 to port B in hexadecimal*/ There is a fxxkin' "/*" .... Bye ....
  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 standard (C2C uses 8N1). There are too many circuits to implement an RS232 interface, MAX232 is the most common but it needs some external capacitors, MAX233 uses the same method. These pump capacitors are use as elevators, because MAX232 can't generate +12/-12V itself because it works with 5V. MAX203 had them implemented inside the chip, in this way the PCB is more simple. Both of them are full-duplex interfaces (you can send and receive sumultaniosly), there is a chip (DS275 or DS276) that is half-duplex (you only can send or receive at a time) it have only 8 pins and had the pump capacitors implemented inside the chip (is more expensive that MAX233 or MAX232). The aplication note for them are in their Datasheets, on the net you can find lots of PCB's for a RS232 interface. But you can do an RS232 Interface with a couple of transistors and resistors if you don't want to spend much money. I think you need to do this: PC<--->Board convert to Board<--->PIC Look if there is a direct connect to a uC using a MAX, perhaps you can jump the RS232 conversion and connect the Board to the PIC adding some test points (soldering into the board). You can do that only if there is no interpreter between PC an uC. If you can't jump RS232 conversion you have to do this: Board<--->MAX232<--->PIC I hope this info were util for your ... Best Regards ... good luck .. Joan
  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 MS-Bits of the ADC process */ } main() { // Hardware Init trisa=00111111b; // PORTA = Input [Output=0;Input=1] trisb=0x00; // PORTB = Output trisc=0x00; // PORTC = Output adcon1 = 10000000b; // PORTA(RA0...RA5)=ANALOG_IN // +Vref= Vdd [5V]; -Vref=Vss [GND] adcon0 = 01000000b; // ADC(RA0) // Clock= 8*Tosc(XX); Channel AN0(XXX);(Go)(X);(-);(ADON) (X) cont=0; portb=0; portc=0; while(1) { ad_result_0 = (Read_ADC_8(0)); //In the main loop it is called like this cont++; portc = cont; portb=ad_result_0; } } ////////////////////////////////////////////////////////////// but It doesn't works. When I run the simulator seems that there is an infinite loop at the instruction while(adcon0 & 0x04) {;} Variable "cont" do not increments and PortB=0 allways. I think there is something I do wrong but I don't know what. Somebody knows what's happenning? Regards; Joan. ???
  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
×
×
  • Create New...