Teade

Collapse

Foorumi reeglid.

Foorumi reeglistik on uuendatud. Palume tutvuda ja arvesse võtta.
See more
See less

Väike PIC ja jadaport

Collapse
X
 
  • Filter
  • Kellaaeg
  • Show
Clear All
new posts

    #16
    basic kood on picbasicu jaoks:
    http://www.mecanique.co.uk/products/compiler/pbc.html
    seal kusagil peaks ka demo versioon olema.
    kui siin Tevalo foorumis olex attachmendid lubatud, saadaks .hex faili.
    igatahes selline näeb välja:
    :100000007928A600380884000930A70003100D20C5
    :10001000A60CA70B072803140D288413B51D1C2854
    :1000200000083604351D36068000841700083604A3
    :10003000031C36068000272800083604031C3606F9
    :100040003519360680008417360980052728350DB6
    :100050000639A0003020A100A00A302000004A2864
    :1000600000308A00200882070134753403341534C7
    :1000700000343C340C34D934A301A200FF30A20771
    :10008000031CA307031C74280330A100DF304A209F
    :100090003E28A101E83EA000A109FC30031C532822
    :1000A000A00703185028A0076400A10F50282018AB
    :1000B0005928A01C5D2800005D2808001030A80009
    :1000C000A101A001A70CA60C031C6C282208A00704
    :1000D00023080318230FA107A10CA00CA50CA40C46
    :1000E000A80B622824087428831303138312640066
    :1000F0000800FF2383168F009F018312BE01640056
    :1001000004303E0203189D283E08A600A7010830CF
    :10011000A200A3015E20B2002508B30041303207DF
    :100120009F000A303C201F150A303C203E083A3E12
    :1001300084001E088000BE0F7F28FA303C20053066
    :10014000B8002030B6000430B500013001203A0874
    :100150000120023001203B080120033001203C082F
    :100160000120043001203D080120FA303C207E2887
    :040170006300B82848
    :02400E00FC3F75
    :00000001FF

    copy-paste ja MPLAB peaks aru saama.

    Comment


      #17
      ah-jaa see oli 12c671 alla kompileeritud, sellist kivi nagu 12F672 ei ole kohanud- 12F675 olemas.
      muidugi vöid ka asmis kirjutada, aga see on nagu K.J.Petersoni Riias koolis käimine : jalgsi ja iga ots kestis nädala.

      Comment


        #18
        Originally posted by raivo@Jul 2 2005, 14:02
        ... nagu K.J.Petersoni Riias koolis käimine : jalgsi ja iga ots kestis nädala.
        Vahepeal on autod, bussid ja rongid leiutatud.... Üle poole tunni ei peaks minema.. asmis kribides. C kood on kena küll aga ei pruugi nii pisikesse flashi ära mahtuda
        - Vend Hieronymus tunneb Motorola toodete nimekirja kõige paremini, las tema ütleb.
        - Motorola poolt loodud kiipide hulgas ei ole teda üles tähendatud. - Tähendab: ta on Intelist!

        Comment


          #19
          paluti mul eespool olnud Basic 12F675-le kompileerida. natuke tuli ka sourci modida, sest registrite nimed teised ja ka ADC 10 bitine. ehk keegi PICdes kogenum viskab pilgu peale. mida see OSCAL reg teeb?

          INCLUDE "MODEDEFS.BAS"
          '---------------------------------------------------------
          ' PIC12F675 SAMPLE ROUTINE FOR 4-CHANNEL, SERIAL, A/D
          '---------------------------------------------------------
          ' PIN NAME USE/CONNECTION
          ' 1 Vdd +5VDC
          ' 2 GPIO.5 SERIAL OUT TO PC
          ' 3 GPIO.4 (CHANNEL 3)
          ' 4 GPIO.3 N/C
          ' 5 GPIO.2 (CHANNEL 2)
          ' 6 GPIO.1 (CHANNEL 1)
          ' 7 GPIO.0 (CHANNEL 0)
          ' 8 Vss (GROUND)
          '---------------------------------------------------------
          DEFINE OSCCAL_1k 1 ' DEFINE OSCCAL FOR PIC12C671
          'ADCON1 = 0 ' PINS TO ANALOG INPUT, Vref = Vdd
          ANSEL = $5F ' clk/16, koik an sisendid
          RESULT VAR BYTE[8] ' 4-BYTE ARRAY
          J VAR BYTE ' A/D CHANNEL NUMBER BYTE VARIABLE

          MAIN:
          FOR J = 0 TO 3 ' 4-CHANNEL COUNTER LOOP
          ADCON0 = 129 + (J*4) ' Left adjusted, SET INPUT,A/D = ON
          PAUSE 10 ' PAUSE 10mS FOR CHANNEL SETUP
          ADCON0.1 = 1 ' SET GO/DONE-BIT + START CONVERSION
          PAUSE 10 ' PAUSE 10mS FOR CONVERSION
          RESULT[J*2] = ADRESH
          RESULT[J*2+1] = ADRESL
          NEXT
          PAUSE 250 ' PAUSE 250mS
          SEROUT GPIO.5,N2400,[1,RESULT[0],RESULT[1],2,RESULT[2],RESULT[3],3,RESULT[4],RESULT[5],4,RESULT[6],ReSULT[7]]
          PAUSE 250 ' PAUSE 250mS
          GOTO MAIN ' DO IT AGAIN

          END ' END PROGRAM

          Hex tuli selline:

          :100000007928A600380884000930A70003100D20C5
          :10001000A60CA70B072803140D288413B51D1C2854
          :1000200000083604351D36068000841700083604A3
          :10003000031C36068000272800083604031C3606F9
          :100040003519360680008417360980052728350DB6
          :100050000639A0003020A100A00A302000004A2864
          :1000600000308A00200882070134753403341534C7
          :1000700000343C340C34D934A301A200FF30A20771
          :10008000031CA307031C74280330A100DF304A209F
          :100090003E28A101E83EA000A109FC30031C532822
          :1000A000A00703185028A0076400A10F50282018AB
          :1000B0005928A01C5D2800005D2808001030A80009
          :1000C000A101A001A70CA60C031C6C282208A00704
          :1000D00023080318230FA107A10CA00CA50CA40C46
          :1000E000A80B622824087428831303138312640066
          :1000F0000800FF23831690005F309F008312C20127
          :100100006400043042020318BC284208A600A7017C
          :100110000430A200A3015E20B2002508B3008130A4
          :1001200032079F000A303C209F140A303C204208CE
          :10013000A600A7010230A200A3015E20B20025089C
          :10014000B30032083A3E84001E0880004208A60030
          :10015000A7010230A200A3015E20B2002508B3006F
          :10016000B20A0319B30A32083A3E840083161E0805
          :1001700080008312C20F8028FA303C200530B8007E
          :100180002030B6000430B500013001203A080120CB
          :100190003B080120023001203C0801203D080120DD
          :1001A000033001203E0801203F08012004300120D7
          :1001B0004008012041080120FA303C207F286300DC
          :0201C000DF2836
          :02400E00FC3F75
          :00000001FF

          Comment


            #20
            OSCCAL registris on kirjas sisemise taktigeneri kalibreerimiskoefitsient. Kui seda mitte rakendada, hakkab prose natuke vale sagedusega tööle ja ajakriitilised rutiinid jamavad. Kui selliseid ei ole, on kõik OK.
            - Vend Hieronymus tunneb Motorola toodete nimekirja kõige paremini, las tema ütleb.
            - Motorola poolt loodud kiipide hulgas ei ole teda üles tähendatud. - Tähendab: ta on Intelist!

            Comment

            Working...
            X