1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

pic programming help

Discussion in 'Microcontrollers' started by williB, Aug 30, 2004.

  1. williB

    williB New Member

    Joined:
    Aug 30, 2004
    Messages:
    2,217
    Likes:
    3
    Location:
    New Jersey
    i shall try that.. :D
     
  2. williB

    williB New Member

    Joined:
    Aug 30, 2004
    Messages:
    2,217
    Likes:
    3
    Location:
    New Jersey
    it worked very very well :D :D
    the program is a lot smaller now. lol
    only three lines are needed ?
    this is very cool.. 8) 8)
    oh , yes i am outputting the code from the switch.. :wink:
     
  3. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,205
    Likes:
    640
    Location:
    Derbyshire, UK
    Sometimes life can be nice and simple :lol:
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. williB

    williB New Member

    Joined:
    Aug 30, 2004
    Messages:
    2,217
    Likes:
    3
    Location:
    New Jersey

    well i coppied your stepper board Nigel,
    after four hours all i have is a vibrating stepper motor. :(
    lol i'm using a stepper made by Minebea Co., Ltd type 23KM-K379-G1
    i am using the four flip flops from the programmer to drive four IFR-510 N channel mosfets set up like you have it & the diodes of course.
    i havnt figured wether i should turn off one line before turning on the next
    * sigh*
     
  6. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,205
    Likes:
    640
    Location:
    Derbyshire, UK
    You need to turn them on in the correct sequence, 1, 2, 3, 4 for full step mode - only one should ever be on at a time (for full step mode).
     
  7. williB

    williB New Member

    Joined:
    Aug 30, 2004
    Messages:
    2,217
    Likes:
    3
    Location:
    New Jersey
    Got it going .. :D
    the transistors were not turning on all the way so i used a 74HCT04 and a varible power supply to boost the voltage to 6 Volts..It works so good that i can hardly keep it from turning .. perfect for a robot..
    so i guess this is my next project. i have allways wanted to build a robot.
    Pic controlled of course. :D :D :D
     
  8. williB

    williB New Member

    Joined:
    Aug 30, 2004
    Messages:
    2,217
    Likes:
    3
    Location:
    New Jersey
    nigel where can i find the list/definitions of the error messages from mpasm ?
     
  9. williB

    williB New Member

    Joined:
    Aug 30, 2004
    Messages:
    2,217
    Likes:
    3
    Location:
    New Jersey
  10. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,205
    Likes:
    640
    Location:
    Derbyshire, UK
  11. williB

    williB New Member

    Joined:
    Aug 30, 2004
    Messages:
    2,217
    Likes:
    3
    Location:
    New Jersey
    Nigel or anyone ...what is $ +2 in this code ??
    this is from the second LED flashing program..

    Code (text):
    Delay   movlw   d'250'          ;delay 250 ms (4 MHz clock)
        movwf   count1
    d1  movlw   0xC7
        movwf   counta
        movlw   0x01
        movwf   countb
    Delay_0
        decfsz  counta, f
        goto    $+2
        decfsz  countb, f
        goto    Delay_0

        decfsz  count1  ,f
        goto    d1
        retlw   0x00

        end      
     
     
  12. Exo

    Exo Active Member

    Joined:
    Sep 18, 2003
    Messages:
    1,953
    Likes:
    1
    Location:
    Belgium
    $ stands for the current address. So 'GOTO $+2' will jump 2 lines forward.
     
  13. williB

    williB New Member

    Joined:
    Aug 30, 2004
    Messages:
    2,217
    Likes:
    3
    Location:
    New Jersey
    thanks :D
    at first i thought it was a label...
     
  14. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,205
    Likes:
    640
    Location:
    Derbyshire, UK
    It's all explained in the MPASM helpfile, you really should try reading it!.
     
  15. williB

    williB New Member

    Joined:
    Aug 30, 2004
    Messages:
    2,217
    Likes:
    3
    Location:
    New Jersey
    i really should... :)
     
  16. williB

    williB New Member

    Joined:
    Aug 30, 2004
    Messages:
    2,217
    Likes:
    3
    Location:
    New Jersey
    Nigel ,the veroboard you use .. i am not familiar with it..
    http://www.winpicprog.co.uk/pic_tutorial_main3_board.htm
    what do you mean when you say cut the tracks..?
    are the connections running vertically down the board ..??


    Oh nice to see the new chips supported..
    i hope to see an analog data aquisition system up soon...kidding...
     
  17. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,205
    Likes:
    640
    Location:
    Derbyshire, UK
    Yes, the tracks are running vertically in that picture, Veroboard is a trade name (presumably the original inventor of the board?), it's also known as stripboard. You cut the tracks with a special tool called a 'spot face cutter', or you can use a small drill in your fingers :lol:
     
  18. techknow

    techknow New Member

    Joined:
    Oct 22, 2004
    Messages:
    70
    Likes:
    0
    help wanted

    hello guys..after a long time without any post...i am back again..hehehe

    i need a very simple asm code for the below:
    when porta ..RA0,RA1,RA2 AND RA3 gets an 4bit binary value it should save on an variable(any variable) and it will call to a data tabe and the value should go to portb.
    Example: when porta gets 0x03h it call datatable after saving it on an variable and port be shoud get out put as..b'00000100'
    when porta gets 0x05h portbshould get as ..b'00010000'
    like this it goes ...so can any one help me..
    i need an very simple code..
     
  19. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,205
    Likes:
    640
    Location:
    Derbyshire, UK
    Re: help wanted

    This is an extremely simple task!, you should be able to write it yourself, just a port read, a lookup table, and a port write. The lookup table needs to be 16 words long, and I would recommend using ANDLW b'00001111' after the port read to make sure the index value is no larger than 15.
     
  20. techknow

    techknow New Member

    Joined:
    Oct 22, 2004
    Messages:
    70
    Likes:
    0
    helpppp

    Code (text):


        bsf     STATUS,RP0 
        movlw   b'00000000'    
        movwf   LEDTRIS
        movlw   b'00001111'
        movwf   trisa
        bcf STATUS,RP0 
        clrf    LEDPORT        

    Read
        movwf   porta
        movf    porta, f
        movwf   count
        movf    count, w       
        call    Table  
        movwf   LEDPORT
        clrf    count          
        goto    Start          

    Table   ADDWF   PCL, f         
        retlw   b'00000000'
            retlw   b'00000001'
            retlw   b'00000010'
            retlw   b'00000011'
            retlw   b'00000100'
            retlw   b'00000101'
            retlw   b'00000110'
            retlw   b'00000111'
            retlw   b'00001000'
            retlw   b'00001001'
            retlw   b'00001010'
            retlw   b'00001011'
            retlw   b'00001100'
            retlw   b'00001101'

        return
        end

    here the code i am using is this will work
     
  21. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,205
    Likes:
    640
    Location:
    Derbyshire, UK
    Re: helpppp

    I would suggest modifying it as I have in your listing.

    You don't need to move W to a register, unless you want to use it elsewhere (which you obviously didn't, as you cleared it).
     

Share This Page