Loading ...
Sorry, an error occurred while loading the content.

FW: Functions for PIC18F452

Expand Messages
  • Wouter van Ooijen
    Can someone fold this into the Jal libraries? ... From: Benjamin Hinrichs [mailto:dh3ben@web.de] Sent: Wednesday, November 26, 2003 1:30 PM To: wouter@voti.nl
    Message 1 of 9 , Nov 26, 2003
    View Source
    • 0 Attachment
      Can someone fold this into the Jal libraries?


      -----Original Message-----
      From: Benjamin Hinrichs [mailto:dh3ben@...]
      Sent: Wednesday, November 26, 2003 1:30 PM
      To: wouter@...
      Subject: Functions for PIC18F452


      Dear Wouter,

      how about including the following code into jpic16 ?
      It has been tested for PIC18F452 using JAL 0459.

      -- disable the A/D to be able to use port a & e as digital input
      procedure disable_a_d_functions is
      assembler
      MOVLW 0x07
      MOVWF ADCON1
      end assembler
      end procedure

      -- read byte d from eeprom at adress a
      procedure eeprom_get (byte in a, byte out d) is
      assembler
      MOVF a, w
      MOVWF EEADR
      BCF EECON1_EEPGD
      BCF EECON1_EEFS
      BCF INTCON_GIE
      BSF EECON1_RD
      MOVF EEDATA, w
      MOVWF d
      BSF INTCON_GIE
      end assembler
      end procedure

      -- write byte d to eeprom at adress a
      procedure eeprom_put (byte in a, byte in d) is
      assembler
      LOCAL loop
      MOVF a, w
      MOVWF EEADR
      MOVF d, w
      MOVWF EEDATA
      BCF EECON1_EEPGD
      BCF EECON1_CFGS
      BSF EECON1_WREN
      BCF INTCON_GIE
      MOVLW 0x55
      MOVWF EECON2
      MOVLW 0xAA
      MOVWF EECON2
      BSF EECON1_WR
      BSF INTCON_GIE
      loop:
      BTFSC EECON1_WR
      GOTO loop
      BCF PIR2_EEIF
      BCF EECON1_WREN
      end assembler
      end procedure


      And this part of jpic16 (JAL 0459):

      var bit pin_e0_direction at trisc : 0
      var bit pin_e1_direction at trisc : 1
      var bit pin_e2_direction at trisc : 2

      should be changed to:

      var bit pin_e0_direction at trise : 0
      var bit pin_e1_direction at trise : 1
      var bit pin_e2_direction at trise : 2


      Best regards,
      Ben
    • Wouter van Ooijen
      ... note: this code always enables interrupts, not a good idea! (same for the write) Wouter van Ooijen -- ------------------------------------------- Van
      Message 2 of 9 , Dec 1, 2003
      View Source
      • 0 Attachment
        > procedure eeprom_get (byte in a, byte out d) is
        > assembler
        > MOVF a, w
        > MOVWF EEADR
        > BCF EECON1_EEPGD
        > BCF EECON1_EEFS
        > BCF INTCON_GIE
        > BSF EECON1_RD
        > MOVF EEDATA, w
        > MOVWF d
        > BSF INTCON_GIE
        > end assembler
        > end procedure

        note: this code always enables interrupts, not a good idea! (same for
        the write)

        Wouter van Ooijen

        -- -------------------------------------------
        Van Ooijen Technische Informatica: www.voti.nl
        consultancy, development, PICmicro products
      • Javier Martínez
        Hi Wouter, ... ... and the same in jpic.jal . :-( -- line 929 in jpic.jal loop: btfsc eecon1_wr -- wait for finishing write goto loop bcf eecon1_wren bsf
        Message 3 of 9 , Dec 1, 2003
        View Source
        • 0 Attachment
          Hi Wouter,


          > note: this code always enables interrupts, not a good idea! (same for
          > the write)


          ... and the same in "jpic.jal". :-(



          -- line 929 in jpic.jal
          loop:
          btfsc eecon1_wr -- wait for finishing write
          goto loop
          bcf eecon1_wren
          bsf intcon_gie -- **** !! ****
          bcf status,5
          bcf status,6 -- bank_0
          end assembler

          ...

          -- line 960 in jpic.jal
          loop:
          btfsc f628_EECON1_WR ; wait for finishing write
          goto loop
          BCF f628_EECON1_WREN ; disable write
          BSF INTCON_GIE ; Enable INTs. *** !! ***
          bcf status,5 ; bank_0
          end assembler



          I've already done the changes in JPIC16. I'll try to modify the both
          files by adding a temporary variable to manage the GIE.



          --
          Regards,
          Javi.
          http://www.japus.org
        • Javier Martínez
          Hi, Files updated. I can t find on datasheets nothing about GIE while reading EEPROM, so I erased this from procedures. Updated also flash_put in jpic.jal
          Message 4 of 9 , Dec 1, 2003
          View Source
          • 0 Attachment
            Hi,

            Files updated. I can't find on datasheets nothing about GIE while
            reading EEPROM, so I erased this from procedures.

            Updated also "flash_put" in jpic.jal (only for f877).


            Tested only up to compilation with 0.4.59.


            [PS] P18f458.jal updated with EECON1_CFGS bit. Why?



            --
            Regards,
            Javi.
            http://www.japus.org
          • Wouter van Ooijen
            ... read the 18Fxxx errata Wouter van Ooijen -- ------------------------------------------- Van Ooijen Technische Informatica: www.voti.nl consultancy,
            Message 5 of 9 , Dec 1, 2003
            View Source
            • 0 Attachment
              > Files updated. I can't find on datasheets nothing about GIE while
              > reading EEPROM, so I erased this from procedures.

              read the 18Fxxx errata

              Wouter van Ooijen

              -- -------------------------------------------
              Van Ooijen Technische Informatica: www.voti.nl
              consultancy, development, PICmicro products
            • japus10
              Hi Wouter, ... OK, it s a work around for a feature . :-) I ll update eeprom_get in JPIC16.JAL only, except you want to modify JPIC.JAL too. ; required
              Message 6 of 9 , Dec 1, 2003
              View Source
              • 0 Attachment
                Hi Wouter,

                > read the 18Fxxx errata

                OK, it's a work around for a 'feature'. :-)

                I'll update eeprom_get in JPIC16.JAL only, except you want to
                modify JPIC.JAL too.


                ; required sequence
                BCF INTCON,GIEH
                BSF EECON1,RD
                MOVF EEDATA,W
                BSF INTCON,GIEH



                Regards,
                Javi
                www.japus.org
              • Wouter van Ooijen
                ... except that you should re-enbale GIEH only when it was set to begin with ! Wouter van Ooijen -- ------------------------------------------- Van Ooijen
                Message 7 of 9 , Dec 1, 2003
                View Source
                • 0 Attachment
                  > ; required sequence
                  > BCF INTCON,GIEH
                  > BSF EECON1,RD
                  > MOVF EEDATA,W
                  > BSF INTCON,GIEH

                  except that you should re-enbale GIEH only when it was set to begin with
                  !

                  Wouter van Ooijen

                  -- -------------------------------------------
                  Van Ooijen Technische Informatica: www.voti.nl
                  consultancy, development, PICmicro products
                • japus10
                  ... with ... Calm! ;-) It s only a copy & paste of the original code. It s like a fast search for me. Regards, Javi. www.japus.org
                  Message 8 of 9 , Dec 1, 2003
                  View Source
                  • 0 Attachment
                    > except that you should re-enbale GIEH only when it was set to begin
                    with
                    > !
                    >
                    > Wouter van Ooijen
                    >


                    Calm! ;-)

                    It's only a copy & paste of the original code. It's like a fast
                    search for me.



                    Regards,
                    Javi.
                    www.japus.org
                  • Javier Martínez
                    Hi all, Updated eeprom_get in JPIC16.jal now meets Errata s sheets. -- Regards, Javi. http://www.japus.org ... --
                    Message 9 of 9 , Dec 2, 2003
                    View Source
                    • 0 Attachment
                      Hi all,

                      Updated eeprom_get in JPIC16.jal now meets Errata's sheets.


                      --
                      Regards,
                      Javi.
                      http://www.japus.org




                      El mar, 02-12-2003 a las 08:05, japus10 escribió:
                      > Hi Wouter,
                      >
                      > > read the 18Fxxx errata
                      >
                      > OK, it's a work around for a 'feature'. :-)
                      >
                      > I'll update eeprom_get in JPIC16.JAL only, except you want to
                      > modify JPIC.JAL too.
                      >
                      >
                      > ; required sequence
                      > BCF INTCON,GIEH
                      > BSF EECON1,RD
                      > MOVF EEDATA,W
                      > BSF INTCON,GIEH
                      >
                      >
                      >
                      > Regards,
                      > Javi
                      > www.japus.org
                      >
                      >
                      >
                      >
                      > To unsubscribe from this group, send an email to:
                      > Jal_developers-unsubscribe@yahoogroups.com
                      >
                      >
                      >
                      > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
                      >
                      >
                    Your message has been successfully submitted and would be delivered to recipients shortly.