Pic16f84 ---> Pic16f628


Closed Thread
Results 1 to 2 of 2
  1. #1
    xak's Avatar
    xak Guest

    Default Pic16f84 ---> Pic16f628

    Hi to all

    Preciso aid of alguem experienced, my knowledge in this subject still is in the start, in my Brazil country pic16f84 is more expensive here (around $10,00) and pic 16f628 is cheaper (around $3,00) therefore would like to modify the code below that it was written for pic16f84 to be used in the 628, as I said before still I do not have experience for this, use soft IC-prog I eat interface AN589, I alguem I can help me?


    I am thankful anticipatedly.

    ;************************************************* ******************************************
    ; message.asm
    ;
    ; This code makes a message appear in mid air.The 5 leds are connected to portb. RB0 - RB4
    ; put new message in below. NOTE: messages too long are a problem, as the
    ; 'persistence of vision' doesn't work.
    ; LEDS connected to port RB0 - 4 tilt/accelerometer to RA0 to start text
    ;
    ; letters are in columns. i.e letter A
    ; 0110
    ; 1001
    ; 1001 the 1's make up the A. 1 = LED on. 0 = off
    ; 1111
    ; 1001
    ;
    ; By Barry Carter
    ;
    ;************************************************* ******************************************

    LIST P=16C84;f=inhx8m

    w equ 0 ; register destination addresses.
    f equ 1
    same equ 1

    z equ 2 ; status flags
    zero equ 2
    c equ 0
    carry equ 0

    count1 equ 0C ; wait counter ls digit file register C
    count2 equ 0D ; wait counter ms digit file register D

    portb equ 06 ; port b I/O register f6
    porta equ 05 ; port a I/O register f5
    status equ 03 ; status register f3
    time equ .15
    ;
    ;
    ;
    org 0 ; origin
    ;
    init
    movlw 0 ;initialise port settings
    tris portb
    movwf portb
    movlw 1
    tris porta
    bcf porta,0

    start
    goto getbut

    ;* TYPE YOUR MESSAGE IN HERE *

    letters call lh ;type in letters here.
    call le
    call ll
    call ll
    call lo
    goto getbut ;goto get button input

    ;* FINISH MESSAGE SECTION *

    getbut bcf status,1
    movf porta,w ;gets input from start button on porta.0
    movwf status ;read status register, to see value of porta
    btfsc status,0
    goto getbut ;if status = 1 then goto letter else goto getbut
    goto letters


    ;*ROUTINES FOR OUTPUTING CHARACTERS TO LED'S ON PORTB*
    ;each letter is prefixed with l e.g la is a

    la call wait ; wait for a bit
    movlw B'00001111' ;output corresponding values out of portb
    movwf portb
    call wait
    movlw B'00010010'
    movwf portb
    call wait
    movlw B'00010010'
    movwf portb
    call wait
    movlw B'00001111'
    movwf portb
    call space1
    return

    lb lz call wait ; wait for a bit
    movlw B'00010001'
    movwf portb
    call wait ;
    movlw B'00010011'
    movwf portb
    call wait
    movlw B'00010101'
    movwf portb
    call wait
    movlw B'00011001'
    movwf portb
    call space1
    return

    space1 movlw B'00000000' ;routine to put spaces between the letters
    call wait
    movlw B'00000000'
    movwf portb
    movlw B'00000000'
    return

    space2 nop ;loop forever
    goto space2


    ;* wait subroutine *

    wait
    movlw time ; load count1 with decimal time
    movwf count1
    d1 movlw time ; load count2 with decimal time
    movwf count2


    d2 decfsz count2,same ; decrement F,skip if zero
    goto d2 ; if not zero
    decfsz count1 ; decrement count1 if count2 is zero
    goto d1 ; do inside loop again if count2 nz
    retlw 00
    ; ----------------------------


    END
    Last edited by xak; - 5th July 2004 at 17:56.

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    There are very few differences between a 16F88 and 16F628...

    Firstly addd this to the defines at the start of your program...

    cmcon equ 0x1F

    Then also at the start of your program where the port tris registers are being defined add...

    movlw 0x07
    movwf cmcon

    Look in the Datasheet (Section 9.0 & 9.1) to see what I have done.

Similar Threads

  1. Watchdog Timers
    By Squibcakes in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th August 2014, 18:03
  2. Multiple if then optimization
    By Mugelpower in forum mel PIC BASIC Pro
    Replies: 35
    Last Post: - 5th March 2008, 12:15
  3. debug -> infrared -> PocketPC??
    By ham789 in forum Serial
    Replies: 4
    Last Post: - 29th November 2007, 14:59
  4. row -> col and col -> row
    By savnik in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 13th April 2007, 01:45
  5. Serout PIC16F628 to PC R18iXL Board
    By Spindle in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 19th June 2005, 00:29

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts