[SOLVED !] mach3 interface


Closed Thread
Results 1 to 12 of 12

Thread: mach3 interface2581 days old

  1. #1
    wilfrieds
    Guest wilfrieds's Avatar

    0 Not allowed!

    Default mach3 interface

    Hi all

    Objective:
    1) Re-use old steppers and their electronics from old junk for CNC, 3D printer, pad printer, etc.. equipment fabrication
    2) Create interface board as cheap and easy as possible.

    Technicals: Mach3 sends 3us signals @ 3.5V to PC parallel port.

    For now: use comparator input to detect push button signal and output to LED
    Code:
    Device = 16F628
        XTAL=4                 ' select internal clock 
        Config boden_off,LVP_off,wdt_off,mclre_off
     
        TRISA =    111111       ' Set PORTA; 1 = input; 0 = output
        TRISB =   000000     ' Set PORTB  msb(v543210)lsb
        CMCON = 000010     ' use internal VREF - comparator inputs RA0 & RA1
                                              ' p.s. we don't use RA1 at this time
                                         ' WE HAVE A PUSH BUTTON ON RA0 FOR TESTING
        VRCON = 001000     ' Internal VREF set to 2.5V with output to RA2 
        PIE1  =   000000     ' enable comparator interrupt.         
        DelayMS 500            ' give PIC some time to initialize
        PORTB.1 = 1            ' check for working pic
           
    loop: 
           If PIR1.6 = 1 Then PORTB.0=~PORTB.0 : PIR1.6=0: DelayMS 500 ' if comparator flag is set then flip flop RB.0 & reset flag
           GoTo loop
           End
    Problem:
    The LED on PORTB.0 flashes at 500Ms without using the push button
    p.s. I measure a 2.5 Volt output on RA2 as planned

    Looking forward to your replies
    Wilfried

    youtube = CNCfromjunk1
    Last edited by wilfrieds; 10th November 2012 at 18:15.

Attention

This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

The advertisements we display are relevant to this web site and your browsing history

Please consider supporting us by disabling your ad blocker.


Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

If you can, please report issues in the forum area WebSite / Forum Issues


Thank you for your attention.

  • #2
    wilfrieds
    Guest wilfrieds's Avatar

    0 Not allowed!

    Default Re: mach3 interface

    Correction - posting keeps on changing code - it rejected my corrections after 20 minutes

    Device = 16F628
    XTAL=4 ' select internal clock
    Config boden_off,LVP_off,wdt_off,mclre_off

    TRISA = %11111111 ' Set PORTA; 1 = input; 0 = output
    TRISB = %00000000 ' Set PORTB msb(%76543210)lsb
    CMCON = %00000010 ' use internal VREF - comparator inputs RA0 & RA1
    ' p.s. we don't use RA1 at this time
    ' WE HAVE A PUSH BUTTON ON RA0 FOR TESTING
    VRCON = %11001000 ' Internal VREF set to 2.5V with output to RA2
    PIE1 = %01000000 ' enable comparator interrupt.
    DelayMS 500 ' give PIC some time to initialize
    PORTB.1 = 1 ' check for working pic

    loop:
    If PIR1.6 = 1 Then PORTB.0=~PORTB.0 : PIR1.6=0: DelayMS 500
    GoTo loop
    End

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #3
    wilfrieds
    Guest wilfrieds's Avatar

    0 Not allowed!

    Default Re: mach3 interface

    IT's alive

    used comparator out, instead of interrupt, to capture a 3 Volt input to RA.0

    It would still be great to know, why I can't get it done with interrupts.


    Wilfried

    posting still keeps on modifing my code when editing
    Last edited by wilfrieds; 11th November 2012 at 13:01.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #4
    wilfrieds
    Guest wilfrieds's Avatar

    0 Not allowed!

    Default Re: mach3 interface

    Code:
    '**********************************************************************
    '*  Name    : stepper driver hardware hack                            *
    '*  Author  : Wilfried                                                *
    '*  Notice  : Freeware                                                *
    '*  Software: Proton picbasic                                         *
    '*  Date    : 11/11/2012                                              * 
    '*  Version : Stepper hack 1.0                                        *
    '*  Notes   : connect to PC parrallel port --> MACH3 or linuxcnc      *
    '*          : step signals to PIC comparator RA0                      *
    '*          : Mach3 step signal = 3us at 3.5Volt to PIC compartor RA0 *
    '*          : direction signal to RA4                                 *
    '**********************************************************************
        Device = 16F628
        XTAL=4                     ' internal clock 
    
    
           Config intrc_osc_noclkout,boden_off,LVP_off,wdt_off,mclre_off
            TRISA =  111111     ' Set PORTA; 1 = input; 0 = output
        TRISB =  000000       ' Set PORTB  msb(v543210)lsb
            VRCON =  001000     ' Internal VREF set to 2.5V with output to RA2 
            CMCON =  000010     ' use internal VREF - comparator inputs RA0 & RA1
                                   ' p.s. we don't use RA1 at this time
                                   ' WE HAVE A PUSH BUTTON ON RA0 FOR TESTING          
            DelayMS 500            ' give PIC some time to initialize
            PORTB.1 = 1            ' check for working pic
            
    loop: 
         If CMCON.6 = 0 Then GoTo delay :Else : GoTo loop
    delay:            
          PORTB.0= ~PORTB.0 ' flip flop portB.0
          DelayMS 100       ' debounce
             
          GoTo loop
          
          End
    Last edited by wilfrieds; 11th November 2012 at 13:08.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #5
    wilfrieds
    Guest wilfrieds's Avatar

    0 Not allowed!

    Default Re: mach3 interface

    Editor does not like the percentage symbol. Keeps on removing it + 2 digits

    Code:
    '**********************************************************************
    '*  Name    : stepper driver hardware hack                            *
    '*  Author  : Wilfried                                                *
    '*  Notice  : Freeware                                                *
    '*  Software: Proton picbasic                                         *
    '*  Date    : 11/11/2012                                              * 
    '*  Version : Stepper hack 1.0                                        *
    '*  Notes   : connect to PC parrallel port --> MACH3 or linuxcnc      *
    '*          : step signals to PIC comparator RA0                      *
    '*          : Mach3 step signal = 3us at 3.5Volt to PIC compartor RA0 *
    '*          : direction signal to RA1                                 *
    '**********************************************************************
        Device = 16F628
        XTAL=4                     ' internal clock 
    
    
    	   Config intrc_osc_noclkout,boden_off,LVP_off,wdt_off,mclre_off
            TRISA =  %11111111     ' Set PORTA; 1 = input; 0 = output
    	TRISB =  %00000000	   ' Set PORTB  msb(%76543210)lsb
            VRCON =  %11001000     ' Internal VREF set to 2.5V with output to RA2 
            CMCON =  %00000010     ' use internal VREF - comparator inputs RA0 & RA1
                                   ' p.s. we don't use RA1 at this time
                                   ' WE HAVE A PUSH BUTTON ON RA0 FOR TESTING          
            DelayMS 500            ' give PIC some time to initialize
            PORTB.1 = 1            ' check for working pic
            
    loop: 
         If CMCON.6 = 0 Then GoTo delay :Else : GoTo loop
    delay:            
          PORTB.0= ~PORTB.0 ' flip flop portB.0
          DelayMS 100       ' debounce
             
          GoTo loop
          
          End

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #6
    Prolific Poster John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,791
    Thumbs Up
    Received: 87
    Given: 34
    Total Downloaded
    4.53 GB

    0 Not allowed!

    Default Re: mach3 interface

    Glad you got it going Wilfrieds. I couldn't help. Did you do a thorough check of the forum and Wiki?
    John

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #7
    wilfrieds
    Guest wilfrieds's Avatar

    0 Not allowed!

    Default Re: mach3 interface

    Hi John

    The closest I could find at the forum was the Kaptains Alternator regulator, where he used the comparator with a hysteresis.

    interesting tutorial site I found www.gooligum.com.au , off course microchips tips and tricks and www.piclist.com etc..., but they are all in assembler.
    Wilfried

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #8
    Kapitan
    Guest Kapitan's Avatar

    0 Not allowed!

    Default Re: mach3 interface

    Quote Originally Posted by wilfrieds View Post
    Hi John

    The closest I could find at the forum was the Kaptains Alternator regulator, where he used the comparator with a hysteresis.

    interesting tutorial site I found www.gooligum.com.au , off course microchips tips and tricks and www.piclist.com etc..., but they are all in assembler.
    Wilfried
    Hello Wilfried
    I had forgotton about that.... seems like a lifetime ago lol ...
    I am experimenting with a 16F1783 at the moment, and this allows limited hysteresis on the comparator by SFR selection - a VERY nice unit..
    Probably of no help to you at all, I appreciate that. The comparator is a super little unit though, and imho, much underused.
    Best of luck with your great project.
    Joe.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #9
    wilfrieds
    Guest wilfrieds's Avatar

    0 Not allowed!

    Default Re: mach3 interface

    Ahoy Joe

    if I can get it to work, then I would like to start a blog or something where I could explain in more detail , pictures, youtube etc..
    Recycle old junk into something more usefull.

    Wilfried

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #10
    Prolific Poster John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,791
    Thumbs Up
    Received: 87
    Given: 34
    Total Downloaded
    4.53 GB

    0 Not allowed!

    Default Re: mach3 interface

    G'day Wilfrieds
    The Wiki serves that purpose. You can write an article and open it for comments if you wish.
    When finished let a mod know and one of us will do the final publish approval.
    Cheers
    John

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #11
    Prolific Poster John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,791
    Thumbs Up
    Received: 87
    Given: 34
    Total Downloaded
    4.53 GB

    0 Not allowed!

    Default Re: mach3 interface

    Wilfried,
    Just noticed in your original program that you have bit6 set to 0. It should be:

    Code:
    PIE1  =   %01000000     ' enable comparator interrupt.  
    Although it is possible that the entry was messed up by the editor in the forum. It was having trouble showing percentage signs.
    Cheers
    John

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #12
    wilfrieds
    Guest wilfrieds's Avatar

    0 Not allowed!

    Default Re: mach3 interface

    Good day John

    Great, will check interrupts again this weekend.

    Good one
    Wilfried

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

    Thread Information

    Users Browsing this Thread

    There are currently 1 users browsing this thread. (0 members and 1 guests)

       

    Similar Threads

    1. help for interface a mcp4131
      By MedTronic in forum WIKI Discussion
      Replies: 2
      Last Post: 12th June 2014, 17:16
    2. Touch interface
      By Tim in forum The Lounge
      Replies: 5
      Last Post: 31st October 2011, 10:36
    3. Basic interface
      By pic-ignorant in forum The Lounge
      Replies: 68
      Last Post: 28th February 2011, 14:16
    4. Interface 4094 !
      By hassawfaa in forum Proton Plus Compiler v3
      Replies: 3
      Last Post: 22nd June 2009, 12:26
    5. [SOLVED !] TFT Interface
      By cotang in forum Proton Plus Compiler v3
      Replies: 11
      Last Post: 9th July 2007, 19:11

    Members who have read this thread : 41

    Actions :  (Set Date)

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

    Tags for this Thread

    Posting Permissions

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