• AVR Freaks

Hot![SOLVED} pic16F1788 - many ports don´t go OUTPUT

Author
joselb
New Member
  • Total Posts : 11
  • Reward points : 0
  • Joined: 2010/09/15 07:52:50
  • Location: Rio de Janeiro, Brazil
  • Status: offline
2020/09/29 12:06:59 (permalink)
0

[SOLVED} pic16F1788 - many ports don´t go OUTPUT

HI
Probably I´m doing a mistake in a basic thing, but...
I´m not being able to put many ports in A,B and C as output as you could see:
portA -> bits 3,5,7 don´t go output, stays in 0
portB -> bits 0,1,2 stays in 1, bits 3,5 stays in 0 
portC -> bits 0,1,7 in 0
 
and the code is something so simple as (uPascal, EasyPic7, suposedly with all jumpers off.
BEGIN
AnselA:= 0; AnselB:= 0; AnselC:= 0;
  trisA:=0; trisB:=0; trisC:=0;
  While 1 do begin
      portA:= $FF; portB:= $FF; portC:= $FF;
      delay_ms(1000);
      portA:= 0; portB:= 0; portC:= 0;
      delay_ms(1000);
  end;
END.
 
I tried also a lot disable the peripherals, no success.
So, do you suggests a simple code to make all ports as output?
Regards
Jose
post edited by joselb - 2020/10/15 07:03:17
#1

11 Replies Related Threads

    1and0
    Access is Denied
    • Total Posts : 11325
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: pic16F1788 - many ports don´t go OUTPUT 2020/09/29 13:04:53 (permalink)
    -1 (1)
    joselb
    and the code is something so simple as (uPascal, EasyPic7, suposedly with all jumpers off.
     
    I tried also a lot disable the peripherals, no success.
    So, do you suggests a simple code to make all ports as output?

    I have not seen anyone used uPascal in this forum yet. So you may be better to post in their forum instead, if they have one.
    #2
    joselb
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2010/09/15 07:52:50
    • Location: Rio de Janeiro, Brazil
    • Status: offline
    Re: pic16F1788 - many ports don´t go OUTPUT 2020/09/29 13:07:34 (permalink)
    0
    sThe assembler i OK too:
    ;EL.mpas,210 ::   BEGIN
    ;EL.mpas,211 ::   trisA:=0; trisB:=0; trisC:=0;
    0x0003 0x0021       MOVLB      1
    0x0004 0x018C       CLRF       TRISA
    0x0005 0x018D       CLRF       TRISB
    0x0006 0x018E       CLRF       TRISC
    ;EL.mpas,212 ::   While 1 do begin
    L__main93:
    ;EL.mpas,213 ::   portA:= $FF; portB:= $FF; portC:= $FF;
    0x0007 0x30FF       MOVLW      255
    0x0008 0x0020       MOVLB      0
    0x0009 0x008C       MOVWF      PORTA
    0x000A 0x30FF       MOVLW      255
    0x000B 0x008D       MOVWF      PORTB
    0x000C 0x30FF       MOVLW      255
    0x000D 0x008E       MOVWF      PORTC
    ;EL.mpas,214 ::   delay_ms(1000);
    0x000E 0x3029       MOVLW      41
    0x000F 0x00FB       MOVWF      R11
    0x0010 0x3096       MOVLW      150
    0x0011 0x00FC       MOVWF      R12
    0x0012 0x307F       MOVLW      127
    0x0013 0x00FD       MOVWF      R13
    L__main97:
    0x0014 0x0BFD       DECFSZ     R13, 1
    0x0015 0x2814       GOTO       L__main97
    0x0016 0x0BFC       DECFSZ     R12, 1
    0x0017 0x2814       GOTO       L__main97
    0x0018 0x0BFB       DECFSZ     R11, 1
    0x0019 0x2814       GOTO       L__main97
    ;EL.mpas,215 ::   portA:= 0; portB:= 0; portC:= 0;
    0x001A 0x018C       CLRF       PORTA
    0x001B 0x018D       CLRF       PORTB
    0x001C 0x018E       CLRF       PORTC
    ;EL.mpas,216 ::   delay_ms(1000);
    0x001D 0x3029       MOVLW      41
    0x001E 0x00FB       MOVWF      R11
    0x001F 0x3096       MOVLW      150
    0x0020 0x00FC       MOVWF      R12
    0x0021 0x307F       MOVLW      127
    0x0022 0x00FD       MOVWF      R13
    L__main98:
    0x0023 0x0BFD       DECFSZ     R13, 1
    0x0024 0x2823       GOTO       L__main98
    0x0025 0x0BFC       DECFSZ     R12, 1
    0x0026 0x2823       GOTO       L__main98
    0x0027 0x0BFB       DECFSZ     R11, 1
    0x0028 0x2823       GOTO       L__main98
    ;EL.mpas,217 ::   end;
    0x0029 0x2807       GOTO       L__main93
    ;EL.mpas,218 ::   END.
    #3
    joselb
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2010/09/15 07:52:50
    • Location: Rio de Janeiro, Brazil
    • Status: offline
    Re: pic16F1788 - many ports don´t go OUTPUT 2020/09/29 13:12:36 (permalink)
    +1 (1)
    1and0
    joselb
    and the code is something so simple as (uPascal, EasyPic7, suposedly with all jumpers off.
     
    I tried also a lot disable the peripherals, no success.
    So, do you suggests a simple code to make all ports as output?

    I have not seen anyone used uPascal in this forum yet. So you may be better to post in their forum instead, if they have one.


    Thanks 1 and 0, but this is not a issue on uPascal, but instead in pic16F1788 ports not being able to go Output.
    #4
    1and0
    Access is Denied
    • Total Posts : 11325
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: pic16F1788 - many ports don´t go OUTPUT 2020/09/29 13:14:47 (permalink)
    0 (2)
    Where are the disassembly code for the ANSELx ?
    #5
    joselb
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2010/09/15 07:52:50
    • Location: Rio de Janeiro, Brazil
    • Status: offline
    Re: pic16F1788 - many ports don´t go OUTPUT 2020/09/29 13:20:12 (permalink)
    0
    It was just another compiling. Here is it:
    ;EL.mpas,210 ::   BEGIN
    ;EL.mpas,211 ::   AnselA:= 0; AnselB:= 0; AnselC:= 0;
    0x0003 0x0023       MOVLB      3
    0x0004 0x018C       CLRF       ANSELA
    0x0005 0x018D       CLRF       ANSELB
    0x0006 0x018E       CLRF       ANSELC
    ;EL.mpas,212 ::   trisA:=0; trisB:=0; trisC:=0;
    0x0007 0x0021       MOVLB      1
    0x0008 0x018C       CLRF       TRISA
    0x0009 0x018D       CLRF       TRISB
    0x000A 0x018E       CLRF       TRISC
    .......
    #6
    joselb
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2010/09/15 07:52:50
    • Location: Rio de Janeiro, Brazil
    • Status: offline
    Re: pic16F1788 - many ports don´t go OUTPUT 2020/09/29 13:25:09 (permalink)
    0
    It was just another compiling. Here is it:
    ;EL.mpas,210 ::   BEGIN
    ;EL.mpas,211 ::   AnselA:= 0; AnselB:= 0; AnselC:= 0;
    0x0003 0x0023       MOVLB      3
    0x0004 0x018C       CLRF       ANSELA
    0x0005 0x018D       CLRF       ANSELB
    0x0006 0x018E       CLRF       ANSELC
    ;EL.mpas,212 ::   trisA:=0; trisB:=0; trisC:=0;
    0x0007 0x0021       MOVLB      1
    0x0008 0x018C       CLRF       TRISA
    0x0009 0x018D       CLRF       TRISB
    0x000A 0x018E       CLRF       TRISC
    .......
     
    ------------------------------------------------
    There is also a lot of other things I tried as:
    IntCon:= 0;   ClrWdt;                    // inibe todas interrupcoes  ==>
      GIE_bit:=0;
     EECON1.WREN:=0;             //end.EEprom apontando p local sem uso + desabilita writes na EEPROM
      Wdtcon:=0;                               //inibe watchDog
      CM1CON0:= 0; CM1CON1:= 0;                // desabilita saida do comparador
      CM2CON0:= 0; CM2CON1:= 0;
      FVRCON:= %00000000;
      ADCON0:= 0; ADCON1:= 0; ADCON2:= 0;
      CM1CON0:=0;   CM2CON0:=0;  CM3CON0:=0;  CM4CON0:=0;
      AnselA:= 0; AnselB:= 0; AnselC:= 0;
      CCP1CON:=0;CCP2CON:=0;CCP3CON:=0;
    OPTION_REG:= %10000100;   //no pullup,.. ,T0SE:TMR0 Clock=instruction cycle,.. ,PSA:Prescaler p/ Tmr0, PS<2:0>=100=32x =1/8us*32=4uS = incremento cada 4uS
      WPUA:=0; WPUB:=0;         //desabilita weak pull ups na porta A e B
    But all these I put and take off durint the multiple tests I did.
     
    post edited by joselb - 2020/09/29 13:31:07
    #7
    upand_at_them
    Super Member
    • Total Posts : 681
    • Reward points : 0
    • Joined: 2005/05/16 07:02:38
    • Location: Pennsylvania
    • Status: offline
    Re: pic16F1788 - many ports don´t go OUTPUT 2020/09/29 14:20:03 (permalink)
    0
    What oscillator are you using?  And where are the config bits?
    #8
    upand_at_them
    Super Member
    • Total Posts : 681
    • Reward points : 0
    • Joined: 2005/05/16 07:02:38
    • Location: Pennsylvania
    • Status: offline
    Re: pic16F1788 - many ports don´t go OUTPUT 2020/09/29 14:32:32 (permalink)
    +3 (3)
    These settings will set all pins to digital:
     
    AnselA:= 0; AnselB:= 0; AnselC:= 0;
    ADCON0:= 0; ADCON1:= 0; ADCON2:= 0;
    CM1CON0:= 0; CM1CON1:= 0; CM2CON0:= 0; CM2CON1:= 0; CM3CON0:= 0; CM3CON1:= 0; CM4CON0:= 0; CM4CON1:= 0;

     
    And you need some form of these for your config:
    pragma target OSC INTOSC_NOCLKOUT (or whatever you're using)
    pragma target PLLEN DISABLED
    pragma target WDT DISABLED
    pragma target BROWNOUT DISABLED
    pragma target FCMEN DISABLED
    pragma target IESO DISABLED
    pragma target LVP DISABLED
    pragma target MCLR EXTERNAL (if external pullup, otherwise INTERNAL)

    post edited by upand_at_them - 2020/09/29 14:33:34
    #9
    joselb
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2010/09/15 07:52:50
    • Location: Rio de Janeiro, Brazil
    • Status: offline
    Re: pic16F1788 - many ports don´t go OUTPUT 2020/09/30 15:03:44 (permalink)
    0
    Thanks upand_at_them
    I tried lots and lots setings, some but not all you suggested. I tink that as I´m only using EasyPic7, the board can be the problem, I mean, as it has lots of things connected to the PIC, maybe I didn´t disconected all board things.
     
    For that I will use a protoboard with an osciloscope, with nothing connected to the pins.
    Let´s see and I will inform progress here.
     
    In meantime if you have any other clue, please, let me know.
    Thanks
    Jose
    post edited by joselb - 2020/09/30 15:09:16
    #10
    ric
    Super Member
    • Total Posts : 28660
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: pic16F1788 - many ports don´t go OUTPUT 2020/09/30 15:27:11 (permalink)
    +1 (1)
    I agree, it's probably your board.
    Like most here, I'm not familiar with uPascal, but if your code is running, then it should be setting all the pins as you want.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #11
    joselb
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2010/09/15 07:52:50
    • Location: Rio de Janeiro, Brazil
    • Status: offline
    Re: pic16F1788 - many ports don´t go OUTPUT 2020/10/15 07:00:56 (permalink)
    0
    Hi ric
    hI upand_at_them  
    Our suposition was correct.
    After a strugling with my protoboard (that I dont use for years), and puting there just the PIC 16F1788, all ports are going to OUT. So, it´s something with EasyPic7 (EP7). Later I will try to find what is goin on, probably some jumper...
    Also I find out that at EP7, the pic heats a little (at protoboard no heat), that indicates that some ports probably are tied to ground / VDD.
    Thanks a lot for all you support.
    Jose
    #12
    Jump to:
    © 2020 APG vNext Commercial Version 4.5