Beam Switches for Laser Table


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

    Default Beam Switches for Laser Table

    This is a simple beam switch using a 16F628 and two steppers.

    '************************************************* ***************
    '* Name : Stepper1.BAS *
    '* Author : Myron Labrecque *
    '* Notice : Copyright (c) 2007 Myron Labrecque *
    '* : All Rights Reserved *
    '* Date : 12/25/2006 *
    '* Version : 1.0 *
    '* Notes : This is for a Beam Switch *
    '* : Can Control 2 Steppers at once *
    '************************************************* ***************

    @ DEVICE pic16F628, INTRC_OSC_NOCLKOUT
    ' System Clock Options
    @ DEVICE pic16F628, WDT_OFF
    ' Watchdog Timer
    @ DEVICE pic16F628, PWRT_ON
    ' Power-On Timer
    @ DEVICE pic16F628, MCLR_OFF
    ' Master Clear Options (Internal)
    @ DEVICE pic16F628, BOD_OFF
    ' Brown-Out Detect
    @ DEVICE pic16F628, LVP_OFF
    ' Low-Voltage Programming
    @ DEVICE pic16F628, CPD_OFF
    ' Data Memory Code Protect
    ' Set to CPD_OFF for Development Copy
    ' Set to CPD_ON for Release Copy
    @ DEVICE pic16F628, PROTECT_OFF
    ' Program Code Protection
    ' Set to PROTECT_OFF for Development Copy
    ' Set to PROTECT_ON for Release Copy

    start:


    ' set variables:
    x VAR BYTE
    steps4 VAR WORD
    steps6 VAR WORD
    stepspause var byte

    clear
    TRISA = %11111111
    TRISB = %00000000
    PORTB = 255
    stepspause = 10

    Pause 1000



    main:
    IF porta.4 = 1 THEN


    if steps4 = 0 then
    portb = %00001010
    pause stepspause
    portb = %00000110
    pause stepspause
    portb = %00000101
    pause stepspause
    portb = %00001001
    steps4 = 1
    ENDIF
    ELSE
    if steps4 = 1 then
    portb = %00001001
    pause stepspause
    portb = %00000101
    pause stepspause
    portb = %00000110
    pause stepspause
    portb = %00001010
    steps4 = 0
    endif

    ENDIF
    IF porta.6 = 1 THEN
    if steps6 = 0 then
    portb = %10100000
    pause stepspause
    portb = %01100000
    pause stepspause
    portb = %01010000
    pause stepspause
    portb = %10010000
    steps6 = 1
    ENDIF
    else
    if steps6 = 1 then
    portb = %10010000
    pause stepspause
    portb = %01010000
    pause stepspause
    portb = %01100000
    pause stepspause
    portb = %10100000
    steps6 = 0
    endif
    endif
    GoTo main

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Hi and welcome on the forum.

    Thanks for your code example ! It will be handy for the other readers/member if you could explain a little bit more about your hardware. Schematic part # etc.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Lookup Table
    By yasser hassani in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 11th March 2008, 10:38
  2. Replies: 14
    Last Post: - 26th April 2007, 15:12
  3. PIC 18F452 Table Pointer/ Table Read
    By sougata in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 14th March 2006, 03:07
  4. Writing to a table.
    By Rhatidbwoy in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 24th December 2005, 16:20
  5. Message String Table using Readcode
    By mytekcontrols in forum Code Examples
    Replies: 2
    Last Post: - 10th July 2005, 23:17

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