Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Visti

  • Rank
  1. Visti


    V. 6.40 OS: W2K PIC16F716 When debugging the PIC16F716 and after setting the GO/DONE flag in ADCON0 register the A/D converter never finishes. GO/DONE remains 1 and interrupt flag ADIF is never set.
  2. Visti

    Union Problem

    Thanks. I came across a minor flaw preparing for other routines in this program. if(a> //(unsigned int types. Both parts of union and structure. Rather complicated) { // empty } It skipped the first two instructions following {} (label placed wrong). Unable to reproduce at present, as I have removed all unions and structures and is using global addressing instead.
  3. V. 6.35. PIC16F876A typedef union { unsigned int ad_info[5]; struct { unsigned int current; unsigned int voltage; unsigned int battemp; unsigned int heatsink; unsigned int max_i; } ad_data; } adinform; adinform actual; . . . Code is a bit clumsy, but I hade to find out, what was going wrong. With test values of 0x03 in hi_byte and 0xc0 in lo_byte I get for(i=0;i<5;i++) { lo=lo_byte; hi=hi_byte; MAKESHORT(test,lo,hi); // test becomes 960 (0x3c0) actual.ad_info=test; test=actual.ad_info; // test
  4. Visti

    Bit Copy

    if(bit1) bit2=1;else bit2=0; is shorter. Not really. "if(bit1) bit2=1;else bit2=0;" compiles into 5 instructions while "bit2 = bit1;" into 4 instructions when bit2 is declared as volatile. Regards, Pavel <{POST_SNAPBACK}> This is what I got CLRF CompTempVar164 BTFSC gbl_bit1,0 INCF CompTempVar164, F BTFSC CompTempVar164,0 BSF gbl_bit2,6 BTFSS CompTempVar164,0 BCF gbl_bit2,6 The transfer itself is 4 but the setup is another 3.
  5. Visti

    Bit Copy

    if(bit1) bit2=1;else bit2=0; is shorter. Mirroring a port is overkill if e.g. only 1 bit is output. The bit2=bit1; could give problems in interrupts as well. I accidently hit the 1 instead of 2. It is 6.32.
  6. Visti

    Bit Copy

    V. 6.31 Target PIC16F877A (must apply to others aswell). bit1=bit2; gives following ... bcf bit1 btfsc bit2 bsf bit1 ... ... meaning that an output (in my case) is toggled when it should stay 1 (took me a couple of hours to figure that one out). Workaround: if(bit2) bit1=1;else bit1=0;
  • Create New...