Jump to content

Koen Schmitz

EstablishedMember
  • Content Count

    15
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Koen Schmitz

  • Rank
    Newbrie

Contact Methods

  • Website URL
    www.baansoraya.com
  • ICQ
    0

Profile Information

  • Location
    Thailand
  1. Dear All, When my program is going through the assembler it failed with an error: symbol is not previously defined TOIF. When I go to settings, options and deselect: insert default interrupt handler; than everything is fine. My target pic is selected as a 16f819 and so far I am correct TOIF is not a 16f819 code but a 16f84 code. Maybe it is me Koen
  2. Dear All, Is it really necessary to manage the status,rp0 bit yourself? Will c2c compiler set the bank for me, will the compiler know what to do with names like e.g. adresh and adresl? With kind regards Koen
  3. Dear All, First I want to thank Pavel for his input however I am a beginner so I do have some questions. Why the value of adresh is correct and adresl is not; e.g. 5v adresh shown 255 but adresl ยบ55?. I thought the 6 bits of adresl should be 0. Do I have to change banks to read adresl because adresl is in bank 1 and adresh in bank 0? Hope some boddy can make me see the light . Thanks in advance Koen Note:program follows #pragma CLOCK_FREQ 4000000 asm __config 2F38h; //'3F38' for INT OSC, '3F29' FOR XT OSC asm list p=PIC16F819 // #include "p16f819.h" #include "..\\Lib/LCD/LCD.h" char valueh,valuel; /* PIC PORT SETUP */ #define PortBConfig 0x00 /* START OF MAIN */ void main(void) { /* First setup PIC Ports and Interrupts */ set_bit( STATUS, RP0 ); set_bit(osccon,IRCF2); // set for 4mhz set_bit(osccon,IRCF1); clear_bit(osccon,IRCF0); adcon1=00001110b; // Left justified AN0 only set_tris_b(0x01); // for other purpose set_tris_a(0xFF); // for other purpose OPTION_REG=11100100b; // for other purpose clear_bit( STATUS, RP0 ); output_low_port_b( LCD_SEL ); // Disable LCD disable_interrupt( GIE ); //disable Global Interrupts /* End of Setup */ LCD_Setup(); /* Setup the LCD device */ delay_s(1); while(1) { adcon0=10000001b; //Fosc/32 clear_bit(intcon,7); delay_ms(1); adcon0 |=4; while (adcon0&4); delay_s(1); valueh=adresh; WriteInt3(valueh); delay_s(1); LcdLine2(); delay_s(1); set_bit( STATUS, RP0 ); valuel=adresl; WriteInt3(valuel); clear_bit( STATUS, RP0 ); delay_s(1); LcdLine1(); } }
  4. Dear All, If I write writeInt3(ADRESH); I get the correct value on my display. When I write ADH=ADRESH; and I write writeInt3(ADH); I will get wrong information on my display . Please tell me why thanks in advance Koen #pragma CLOCK_FREQ 4000000 asm __config 2F38h; //'3F38' for INT OSC, '3F29' FOR XT OSC asm list p=PIC16F819 // #include "p16f819.h" #include "..\\Lib/LCD/LCD.h" #define LCD_SEL 2 // Port A bit 2 ( Enables LCD ) */ #define LCD_RS 3 // Port A bit 3 ( Register select ) #define LVL_in 3 // TOCK1 input #define LCD_DATA_4 4 // LCD BIT 4 */ #define LCD_DATA_5 5 // LCD BIT 5 */ #define LCD_DATA_6 6 // LCD BIT 6 */ #define LCD_DATA_7 7 // LCD BIT 7 char ADCON0@0x1f; char ADCON1@0x9f; char ADRESH@0x1e; char ADRESL@0x9e; char ADH,ADL; /* PIC PORT SETUP */ #define PortBConfig 0x00 /* Configure port B */ /* START OF MAIN */ void main(void) { /* First setup PIC Ports and Interrupts */ set_bit( STATUS, RP0 ); set_bit(osccon,IRCF2); // set for 4mhz set_bit(osccon,IRCF1); clear_bit(osccon,IRCF0); ADCON1=00000100b; set_tris_b(0x01); set_tris_a(0xFF); // all inputs OPTION_REG=11100100b; // scale 1:32 clear_bit( STATUS, RP0 ); output_low_port_b( LCD_SEL ); // Disable LCD disable_interrupt( GIE ); //disable Global Interrupts /* End of Setup */ LCD_Setup(); /* Setup the LCD device */ delay_s(1); while(1) { ADCON0=10000001b; clear_bit(intcon,7); delay_ms(1); ADCON0 |=4; while (adcon0&4); delay_s(1); ADH=ADRESH; ADL=ADRESL; WriteInt3(ADH); delay_s(1); LcdLine2(); delay_s(1); WriteInt3(ADL); delay_s(1); LcdLine1(); } }
  5. Dear All, How can I change a negative number in to the same number but then positive e.g -4 should become 4. Further more I want to say thanks to all of you who helped me with my previous questions. Koen
  6. I think the 16f628 has no internal ADC ,Use a16f819. Koen
  7. Thanks to all of you who gave me a good hint. Koen
  8. Dear All, I have to multiply with a factor -0.74. Please can give somebody an example. Thanks in advance Koen
  9. Dear All, How can I use in my software a value of -0.74 ? -0.74 is not exepted -74/100 comes back as 0 . thanks in advance Koen
  10. Hi All, Sorry but I have to ask again, build a nice working program but now I want to separate the LCD part for use in the next application as in include file and make a header file. Tried but it does not work do not know how to make an include file or header file. Is it possible without using the wizard? Hope some body will make this clear to me. Thanks in advance Koen
  11. Dear Pavel, Thanks very much for your reply, will implement it. Regards Koen
  12. Hi All, This is a part of an A to D conversion routine: bsf ADCON0,2 loop btfsc ADCON0,2 Goto loop How can I rewrite this in C I tried with a while loop but it did not work Thanks in advance Koen
  13. Found the problem it needs 2 underscores before the CONFIG.
  14. Dear All, Last week I purchased C2Cand I have really some difficulties understanding it all. There is not a lot of explanation given with this product so that beginners like me can enjoy it and understand it too, we not all so smart as you all. I have some question and maybe one is so kind to explain, I think I will be able to get on from there. Please one of your C gurus help me out. 1 How can I e.g. a file.c file save as a function file.h and place it in the library. 2 Can I save an ASM file as a function and place it in the library. 3 can I use MPLAB as my assembler and will I be able to still use the plugins? Your help will be highly appreciated With kind regards Koen
  15. Dear All, First sorry for so many stupid questions but I am a newbie. Question how can set the config word in C instead of in the pic programmer, my little (first) program in C is working but asm_config etc. is generated a error(108) illegal character (0) although I Copy it from a example program fcounter.c. Help will be highly appreciated With kind Regards Koen My program: #include #pragma CLOCK_FREQ 4000000 asm _CONFIG _CP_OFF _WDT_OFF _XT_OSC _PWRTE_ON main() { set_bit( STATUS, RP0 ); set_tris_b(0x00); set_tris_a(0x00); clear_bit( STATUS, RP0 ); output_port_b( 0x00 ); output_port_a( 0x00 ); while( 1 ) { set_bit(PORTA,0); delay_ms(1); clear_bit(PORTA,0); delay_ms(1); } }
×
×
  • Create New...