Friday, 13 November 2015

PIC16F876A Based A.V.R ( VOLTAGE STABILIZER )

I have be thinking about a pic microcontroler based voltage regulator for about 3 years now; last week i install a 2.5kva 36V inverter for a consumer of mine... 3 days later he called me that the inverter is not charging the battery well... so i ask him to call me and check the input voltage on the lcd screen when ever their is a mains supply (NEPA).... so he called  confirming that the input voltage was 108volt; we had to design a  2kva automatic voltage regulator from 80V - 260V...

Features:
Low voltage protection
High voltage protection
Delay function
Calibration mode
Delay indicator
High/low voltage indicator



4 Relays voltage stabilizer

 ON 187V INPUT TEST ON PROTEUS

 ON 218V INPUT TEST ON PROTEUS 

 ON 262V INPUT TEST ON PROTEUS WITH HIGH VOLT GUIDE 



RELAY CONFIGURATION

TRANSFORMER CONFIGURATION



A

 
B






  








Repair of 2kva AVR


Old board


New board



TEST1


READY


Monday, 3 August 2015

GSM/GPS VEHICLE GEOGRAPHICAL TRACKER




The project is based on a Gsm/Gps/Gprs. Its main function is to detect a illegal entry and communicate its own geographical position using, on the choice, the cellular phone reference system or the GPS. I use the recent product by SIMCOM - SIM908 which operate on 5 - 12 volt  dc supply, which makes it work on wide-range dc power supply...  Well i still cant believe that i  can burn a code of 21kb  into program memory chip of 14kb (pic16f876a), but, it works all good.... 
maybe one of this days am gonna write a code of 30kb on this mircontroller chip, just wanna confirm the max. program memory size....  
 The featuring  mircontroller chip is the pic16f876a, the reason i keep using this chip is because it cost less than $2 and I guess is available in all country... 



1st TEST VIDEO

The GPS Tracker is a small gadget that will record exactly where your vehicle, boat or aeroplane has travelled over time. It is intended to be wired into the ignition of your vehicle and then forgotten.
It will record your travels in Google Earth format, GPS Exchange format or as raw NMEA data and using software such as Google Earth you can then see your trips mapped onto the surface of the earth with a resolution of a few meters. Below are my experimental pics, pcb layout, and code....





PROTEUS SIMULATION 


SIM908 CONNECTION 1


SIM908 CONNECTION 2

PCB MAKING 1

PCB MAKING 2


PCB AND COMPONENT FIXING

PC GPS SERIAL BOARD QUICK TEST


FIRST TEST ON GET GPS LOCATION WITH SMS COMMAND




COMPLETE PCB LAYOUT AND CODE: http://1drv.ms/1Lof3e1

Code written in picbasic pro
'GSM AND GPS CONTROLLER
'PROGRAMMER : AYOMIDE
'USER: OPEYEMI
'ACECCT.BLOGSPOT.COM
'PIC16F876A
'2015

 DEFINE OSC 4
     include "modedefs.bas"

' Define ADCIN parameters
Define ADC_BITS     10    ' Set number of bits in result
Define ADC_CLOCK    3     ' Set clock source (3=rc)
Define ADC_SAMPLEUS 50    ' Set sampling time in uS

'-------------[PORT INITIALIZATION]-----------------
      ' 76543210
TRISA = %11111111
ADCON1 = 7
PORTB = 000000  'reset portB resigters to zero
TRISB = 000000  'Setting portB as output port
PORTC = 000000  'reset portC resigters to zero
TRISC = %10000000

'--------------[LCD DEFINES]----------------------
DEFINE LCD_DREG PORTB ' LCD Data bits on PORTB
DEFINE LCD_DBIT 4 ' PORTB starting address
DEFINE LCD_RSREG PORTB ' LCD RS bit on PORTB
DEFINE LCD_RSBIT 2 ' LCD RS bit address
DEFINE LCD_EREG PORTB ' LCD E bit on PORTB
DEFINE LCD_EBIT 3 ' LCD E bit address
DEFINE LCD_BITS 4 ' LCD in 4-bit mode
DEFINE LCD_LINES 2  ' DEFINE LCD ROW AS 2

'VARIABLE ------------------------------
LCD_MOVE VAR WORD ' LCD AMINATION
AT_TEST VAR WORD : AT_TEST = 0
OWNER VAR WORD
SENDER VAR BYTE[25] : SENDER = 0
NET2 VAR WORD
A0 VAR WORD : A0 = 0
BUFF160        VAR BIT[160]
ENCODER90 VAR BYTE[90]
LAT20 VAR BYTE[20]
LONG20 VAR BYTE[20]
ENCODER10 VAR BYTE[10]
A2 VAR WORD : A2 = 0
KEY VAR PORTB.0
B0 VAR WORD
LOCATE VAR WORD : LOCATE = 0

'--------- ASCII ---------------
ENTER con 13
CTRLZ CON 26

' ------- COMMUNICATION PORT --------------
REMOTE_RX VAR PORTC.0
GSM_TX VAR PORTC.6
GSM_RX VAR PORTC.7

' ----------- PORT ALIASES -----------------
OWNER_SW VAR PORTA.5
BOOT VAR PORTA.1
DOOR VAR PORTA.2
BONNET VAR PORTA.3
RELAY_RX VAR PORTA.4

SECURED_LED VAR PORTC.0
ENGINE_LED VAR PORTC.1
DOOR_LED VAR PORTC.2

BUZZER VAR PORTC.3
ENGINE_RELAY VAR PORTB.0
DOOR_RELAY VAR PORTB.1


'---------[LCD INITIALIZATION]-----------
LCDOUT $FE,1 ' CLEAR SCREEN
LCDOUT $FE,2
PAUSE 500          ' Wait .5 second for lcd to ready

ON_MODULE:  ' ACTIVATE GSM/GPRS/GPS MODULE
low BUZZER: LOW RELAY_RX: LOW ENGINE_RELAY: LOW DOOR_RELAY
HIGH ENGINE_LED : HIGH DOOR_LED : HIGH SECURED_LED : PAUSE 1000
LOW ENGINE_LED : LOW DOOR_LED : LOW SECURED_LED
      PAUSE 10: LOW PORTC.5: PAUSE 1000
      HIGH PORTC.5: PAUSE 500
   high BUZZER : PAUSE 800: low BUZZER: PAUSE 200
   LCDOUT "AJAYI OMOYEMI A."  : LCDOUT $FE, $C0
LCDOUT "  EEE/11/5048   "
PAUSE 2500
LCDOUT $FE,1 ' CLEAR SCREEN  
CHECK_GSM:
CLEAR          ' CLEAR ALL VARIABLE

'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
for AT_TEST = 0 to 3
SEROUT2 GSM_TX,84,["AT",$0D,$0A]
     LCDOUT $FE, $C0 : LCDOUT " Initialize !!! "
       lcdout $fe,$8
        pause 500
          lcdout $fe,$c
            pause 500
next AT_TEST

PAUSE 300  
SEROUT2 GSM_TX,84,["AT+CMGF=1",ENTER] : PAUSE 300
   SEROUT2 GSM_TX,84,["AT+CMEE=1",ENTER] : PAUSE 300
     
LCDOUT $FE,1 ' CLEAR SCREEN
FOR NET2 = 0 TO 2      ' GET NETWORK STATUS
PAUSE 100 : LCDOUT "SEARCHING SIM908"
   SEROUT2 GSM_TX,84,["AT+CSQ",ENTER]
     SERIN2 GSM_RX,84,3000,CHECK_GSM,[WAIT("+CSQ: "), STR ENCODER90\6] : PAUSE 2
         LCDOUT $FE, $C0 : LCDOUT "  CSQ:    ", STR ENCODER90\6  : PAUSE 1500
NEXT NET2

PAUSE 2
SEROUT2 GSM_TX,84,["AT+CSQ",ENTER]
  SERIN2 GSM_RX,84,3000,GSM_CHECK_ERR,[WAIT("OK")]  : pause 100
      LCDOUT $FE, $C0 : LCDOUT "SIM908 CONNECTED" : PAUSE 2500
         HIGH BUZZER :PAUSE 500 :LOW BUZZER  :PAUSE 200
            HIGH BUZZER :PAUSE 500 :LOW BUZZER  :PAUSE 2
GOTO SEND_OKGSM

GSM_CHECK_ERR:
LCDOUT $FE, $C0 : LCDOUT " NOT  CONNECTED "
PAUSE 1500

'*****************************************************************
SMS_SETUP:
PAUSE 500
SEROUT2  GSM_TX,84,["AT+CMGF=1",ENTER]    ' SW TO SMS MODE
PAUSE 500
SEROUT2 GSM_TX,84,["AT+CMGS=",34,"+2348100581270",34,ENTER]
PAUSE 500
RETURN

SEND_SMS:
PAUSE 300
  SEROUT2 GSM_TX,84,[CTRLZ]
     SEROUT2 GSM_TX,84,[26]
        PAUSE 5000
LCDOUT $FE,1 ' CLEAR SCREEN
   LCDOUT $FE, $C0 : LCDOUT "  MESSAGE SENT "
   HIGH BUZZER :PAUSE 500 :LOW BUZZER  :PAUSE 3000
   LCDOUT $FE,1 ' CLEAR SCREEN
  
      RETURN
'******************************************************************

SEND_OKGSM:
GOSUB SMS_SETUP
SEROUT2 GSM_TX,84,["SIM908 - GSM/GPRS/GPS CONNECTED AND OK, "," NETWORK CSQ: ",STR ENCODER90\6,_
" [ VEHICLE SECURED ]",ENTER]  :PAUSE 500
   GOSUB SEND_SMS
      PAUSE 1000

MAIN_PROGRAM:
LCDOUT $FE,1 ' CLEAR SCREEN
   LCDOUT "SIM908 CONNECTED"
      LCDOUT $FE, $C0 :LCDOUT "VEHICLE  SECURED"
      HIGH SECURED_LED :PAUSE 500 :LOW SECURED_LED 
         PAUSE 700

IF BOOT = 0 OR DOOR = 0 OR BONNET = 0 THEN  ' CHECK DOOR
  HIGH BUZZER :PAUSE 500 :LOW BUZZER  :PAUSE 200
    HIGH BUZZER :PAUSE 500 :LOW BUZZER  :PAUSE 200
    HIGH BUZZER :PAUSE 500 :LOW BUZZER  :PAUSE 2
 SEROUT2  GSM_TX,84,["AT+CMGD= 1",ENTER]  
      LCDOUT $FE, $C0 :LCDOUT " VEHICLE OPENED "
        PAUSE 2000
GOTO CHECK_OWNER
ENDIF
PAUSE 2000
GOTO MAIN_PROGRAM


CHECK_OWNER:
LCDOUT $FE,1 ' CLEAR SCREEN
PAUSE 2
 FOR OWNER = 1 TO 15
   LCDOUT "  VERIFY OWNER  "
     LCDOUT $FE, $C0 :LCDOUT " IN 15 SECOND(S)"
       PAUSE 1000
        IF OWNER_SW = 0 THEN MAIN_PROGRAM
 NEXT OWNER
 IF OWNER = 15 THEN GOTO SMS_OWNER
 SMS_OWNER:
SEROUT2 GSM_TX,84,["AT+CMGD=1",ENTER] : PAUSE 1000  ' DELETE ALL INBOX
GOSUB SMS_SETUP
SEROUT2 GSM_TX,84,["AN INTRUDER DETECTED, REPLY (CMD:ACIVATE_ LOCK (OR) UNLOCK, ALARM (OR)SILENT, GET_LOCATION, OWNER",ENTER]  :PAUSE 500
   GOSUB SEND_SMS
     PAUSE 1000
  CLEAR
DECODE_SMS:
  LCDOUT $FE,1 ' CLEAR SCREEN
PAUSE 100
LCDOUT "WAITING FOR  SMS": PAUSE 500
SEROUT2  GSM_TX,84,["AT+CMGR= 1",ENTER]    ' READ INBOX 1
'SERIN2  GSM_RX,84,3000,DECODE_SMS,[WAIT("+CMGR:"),SKIP 0, STR ENCODER90\20] : PAUSE 50
SERIN2  GSM_RX,84,1500,DECODE_SMS,[WAIT(47),SKIP 14, STR ENCODER90\24] : PAUSE 50
LCDOUT $FE, $C0
LCDOUT "SMS 1: ", STR ENCODER90(19)
    'for B0=1 to 108    'MOVE LEFT
     ' lcdout $fe,$1e
        pause 3000
    'next B0
   
if (ENCODER90(19)="L") THEN      ' ACTIVATE LOCK
HIGH DOOR_RELAY  : HIGH DOOR_LED
HIGH ENGINE_RELAY : HIGH ENGINE_LED: PAUSE 5
GOSUB DELETE_SMS
ENDIF
if (ENCODER90(19)="U") THEN     ' ACTIVATE UNLOCK
LOW DOOR_RELAY  : LOW DOOR_LED
LOW ENGINE_RELAY : LOW ENGINE_LED: PAUSE 5
GOSUB DELETE_SMS
ENDIF
if (ENCODER90(19)="A") THEN    ' ACTIVATE ALARM
HIGH BUZZER : PAUSE 5
GOSUB DELETE_SMS
ENDIF
if (ENCODER90(19)="S") THEN      ' ACTIVATE SILENT
LOW BUZZER : PAUSE 5   
GOSUB DELETE_SMS
ENDIF
if (ENCODER90(19)="G") THEN     ' ACTIVATE GET LOCATION
LOW BUZZER : PAUSE 5
gosub  GET_LOCATION  
GOSUB DELETE_SMS
ENDIF
if (ENCODER90(19)="O") THEN    ' ACTIVATE OWNER
LOW BUZZER
LOW DOOR_RELAY  : LOW DOOR_LED
LOW ENGINE_RELAY : LOW ENGINE_LED: PAUSE 5 
GOSUB DELETE_SMS
LCDOUT $FE,1 ' CLEAR SCREEN
LCDOUT "VEHICLE  SECURED"  : LCDOUT $FE, $C0
LCDOUT " OWNER VERIFIED "
PAUSE 10000
GOTO MAIN_PROGRAM
ENDIF
GOTO DECODE_SMS

DELETE_SMS:
 SEROUT2  GSM_TX,84,["AT+CMGD= 1",ENTER]
 PAUSE 1
 RETURN

 GET_LOCATION:
CLEAR
LCDOUT $FE,1 ' CLEAR SCREEN
PAUSE 50     
SEROUT2  GSM_TX,84,["AT+CGPSPWR=1",ENTER]    ' POWER ON THE GPS MODULE
PAUSE 500
SEROUT2  GSM_TX,84,["AT+CGPSRST=1",ENTER]    ' POWER ON THE GPS MODULE
PAUSE 500
SEROUT2  GSM_TX,84,["AT+CGPSIPR=9600",ENTER]    ' POWER ON THE GPS MODULE
PAUSE 500

LOCATION:
for LOCATE = 0 TO 2
SEROUT2  GSM_TX,84,["=AT+CGPSINF=32",ENTER]    ' get location
'HSERIN 2000,SETUP,[SKIP 5,WAIT (10),STR BUFF\20\13]
'SERIN2  GSM_RX,84,[WAIT("+CMGR: "),SKIP 45, STR ENCODER90\20] : PAUSE 200
SERIN2  GSM_RX,84, 1000, LOCATION,[WAIT("A,"),STR LAT20\12] : PAUSE 200
PAUSE 500
SEROUT2  GSM_TX,84,["AT+CGPSINF=32",ENTER]    ' get location
SERIN2  GSM_RX,84,[WAIT("N,"),SKIP 0, STR LONG20\12] : PAUSE 200
LCDOUT $FE,1 ' CLEAR SCREEN

PAUSE 200
LCDOUT $FE, $C0
LCDOUT "DOWNLOADING....."
PAUSE 1500
NEXT LOCATE
'------- SEND LOCATION TO MOBILE ------------------------
GOSUB SMS_SETUP
SEROUT2 GSM_TX,84,[" CURRENT VEHICLE LOCATION :::  LAT :", STR LAT20\12,"   ","LON: ", STR LONG20\12  , ENTER] 
PAUSE 500

'SEROUT2 GSM_TX,84,["SIM908 - GSM/GPRS/GPS CONNECTED AND OK, "," NETWORK CSQ: ",STR ENCODER90\6,_
'" [ VEHICLE SECURED ]",ENTER]  :PAUSE 500
   GOSUB SEND_SMS
      PAUSE 1000
RETURN

end



If you have any question, feel free to comment on this post and ask me any question.... acecct.18f4550@gmail.com OR call me on :  +2348123206299

Thursday, 25 June 2015

PICKIT 2 CLONE PROGRAMMER

PICKIT 2 CLONE PROGRAMMER

PROJECT DESCRIPTION:

This is my PICkit 2 clone design. Its based on a simplified version of the Microchip PICkit 2 schematic and only supports 5v parts. It works with all the Microchip software including MPLAB, MPLABX,the PICkit 2 GUI Programming software and the PICkit 2 command line software.



FIG1: CIRCUIT DIAGRAM


FIG2: 3D PREVIEW

FIG3: PCB  VIEW1



FIG4: PCB  VIEW2




FIG5: PCB  VIEW3



FIG6: TESTING1



FIG6: 28 PIN uC configration



FIG6: 18 PIN uC configration


FIG6: 8 PIN uC configration 


FIG6: 8 NEW PICKIT2 WITH DSP SOCKET




To purchase PICKIT 2 CLONE PROGRAMMER (empty & complete) 
Lagos (nigeria): Call- 09020322481
Akure (nigeria): Call- 08123206299
Email :  acecct.18f4550@gmail.com 

 If you have any question, feel free to comment on this post.... acecct.18f4550@gmail.com OR whatsapp me on :  +2348123206299

PICKIT 2 CLONE PROGRAMMER COMPLETE FILE:  https://www.datafilehost.com/d/b06ac5ef

Sunday, 21 June 2015

PCB LAMINATOR CONTROLLER, CODE AND PCB PRINTING

PCB ASSISTANT LAMINATOR CONTROL: 

To make smart looking PCB's, all you need is: A computer, a laser printer, copper clad board, etchant, A3/A4 laminating machine and some  glossy photo paper. You can buy special film for making PCB's, but I have found that the glossy paper gives better results. I use photo quality glossy paper for inkjet printers.

I got an  A3/A4 laminating machine for about $40(N 8000) in the computer store last week, for my sine wave mother board production, and i needed to produce a total sum of 50 pcs control boards for a new consumer of mine... then, i got tried of the forward and the reverse of a single control board for about 25 times  to get it done... well, i was able to press about 12pcs  in 2 days... then i taught of making a pcb  assistant laminator control  with a lcd display...

Use a laser printer to print the image on the glossy side of the photo paper. Clean the copper clad board with steel wool or very fine wet sandpaper. Dry the board thoroughly. Make sure that the board is clean and free from fingerprints. Place the photo paper face down on the copper clad board. Use masking tape to hold the paper in position. Don't use vinyl tape. Place the board on a flat surface. You will be using a very hot iron, so don't use the dining room table. I use the back of an old telephone directory. Use a hot clothes iron to transfer the track pattern from the paper to the copper board. Don't be afraid to use lots of heat and pressure. Allow the board to cool. Don't be tempted to lift the paper. Put the board in a container full of warm soapy water. After about twenty minutes the paper will begin to dissolve and disintegrate. Carefully remove the paper from the copper board. Rinse under a cold tap to remove paper residue. You may need to touch up any broken tracks with an etch resist pen. I use a fine Staedtler laundry marker.

VIDEO: =https://youtu.be/cbb-fya8asU



The featuring M.C.U is the pic16f876a:



Circuit


Simulation test




Control board



Pcb design 1


Pcb design 2







Old design


New design 1


New design 2


New design 3


New design 4

Code written in picbasic pro

'****************************************************************
'*  Name    : LAMINATING MACHINE.BAS                            *
'*  Author  : AKINSINMIDE IMOLEAYO                              *
'*  Notice  : Copyright (c) 2015 [select VIEW...EDITOR OPTIONS] *
'*          : All Rights Reserved                               *
'*  Date    : 5/31/2015                                         *
'*  Version : 1.0                                               *
'*  Notes   :                                                   *
'*          :                                                   *
'****************************************************************

'F876A

Define   OSC 4          ' 4MHz crystal used

' Define ADCIN parameters
Define ADC_BITS     10    ' Set number of bits in result
Define ADC_CLOCK    3     ' Set clock source (3=rc)
Define ADC_SAMPLEUS 50   ' Set sampling time in uS   

'--------------[LCD DEFINES]----------------------
DEFINE LCD_DREG PORTC ' LCD Data bits on PORTC
DEFINE LCD_DBIT 4 ' PORTB starting address
DEFINE LCD_RSREG PORTC ' LCD RS bit on PORTC
DEFINE LCD_RSBIT 2 ' LCD RS bit address
DEFINE LCD_EREG PORTC ' LCD E bit on PORTC
DEFINE LCD_EBIT 3' LCD E bit address
DEFINE LCD_BITS 4 ' LCD in 4-bit mode
DEFINE LCD_LINES 2

'-------------[PORT INITIALIZATION]-----------------
TRISA = 001111      ' Set PORTA as  INPUT AND OUTPUT
ADCON1 = %10000010  ' Set PORTA analog and right justify result
PORTB = 000000     'set PORTB as output
TRISB = 001111    'set TRISB as both input and output

'VARIABLE ------------------------------
A VAR WORD : A = 0
B VAR WORD : B = 0
 LED_FLASH VAR BYTE
 BT VAR WORD : BT = 0
 BT1 VAR WORD : BT1 = 0
 BT2 VAR WORD : BT2 = 0
 UNIT VAR WORD [40] : UNIT = 0
 L_UNIT VAR WORD : L_UNIT = 0
 W_UNIT VAR WORD : W_UNIT = 0
 R_UNIT VAR WORD : R_UNIT = 0
 RUN_UNIT VAR WORD :  RUN_UNIT = 0
 COUNTEXIT VAR WORD : COUNTEXIT = 0
 COUNTOK VAR WORD : COUNTOK = 0
 COUNTRUN VAR WORD : COUNTRUN = 0
 COUNT_EXIT VAR WORD : COUNT_EXIT = 0
 L0 var word : L0 = 0

'----------- [PORT B] -------------
BUZZER VAR PORTB.7
FORWARD VAR PORTB.6
BACKWARD VAR PORTB.5
ON_OFF VAR PORTB.4
OK_KEY VAR PORTB.3
EXIT_KEY VAR PORTB.2
UP_KEY VAR PORTB.1
DOWN_KEY VAR PORTB.0

'----------- [PORT C] -------------
WORKING_LED VAR PORTC.0
FINISHED VAR PORTC.1
BUZZ_DELAY CON 120

'---------[LCD INITIALIZATION]-----------
LCDOUT $FE,1 ' CLEAR SCREEN
LCDOUT $FE,2
PAUSE 1000          ' Wait 1 second

LOADING:
'FOR LED_FLASH = 0 TO 5
HIGH WORKING_LED : PAUSE 600
LOW WORKING_LED : PAUSE 300
'NEXT LED_FLASH
HIGH BUZZER :PAUSE BUZZ_DELAY :LOW BUZZER  :PAUSE 200
HIGH BUZZER :PAUSE BUZZ_DELAY :LOW BUZZER  :PAUSE 200
HIGH BUZZER :PAUSE BUZZ_DELAY :LOW BUZZER  :PAUSE 2

'---------------[ PROGRAM START HERE ]--------------------
MAIN: pause 10
high  ON_OFF
        LCDOUT $FE,1 ' CLEAR SCREEN
          pause 200 
LCDOUT "*****************"
LCDOUT $FE, $C0 : LCDOUT "|ACE TECHNOLOGY|" : PAUSE 2000 : LCDOUT $FE,1
LCDOUT " LAMINATING PCB "
LCDOUT $FE, $C0 : LCDOUT " PRO. ASSISTANT " : PAUSE 2000 : LCDOUT $FE,1
' ::::::::::::::::::::::::::::::::::::::::::::::::::::::::

MEASURE:
LCDOUT $FE,1 ' CLEAR SCREEN
PAUSE 2
LOW BACKWARD
PAUSE 120
LCDOUT "PLEASE ENTER PCB"
LOW FINISHED : low WORKING_LED  : HIGH FORWARD

GET_LENGTH:
pause 50 : GOSUB GET_KEY
L_UNIT = UNIT
LCDOUT $FE, $C0 : LCDOUT "LENGTH(S): " , DEC2 UNIT ," CM" : PAUSE 100
IF OK_KEY = 0 THEN
HIGH BUZZER :PAUSE BUZZ_DELAY :LOW BUZZER  :PAUSE 2
GOTO GET_WIDTH1
ENDIF
GOTO GET_LENGTH

GET_WIDTH1: PAUSE 2
UNIT = 0
GET_WIDTH:  
pause 50 : GOSUB GET_KEY
W_UNIT = UNIT
LCDOUT $FE, $C0 : LCDOUT "WIDTH(S) : " , DEC2 UNIT ," CM" : PAUSE 100
IF OK_KEY = 0 THEN
HIGH BUZZER :PAUSE BUZZ_DELAY :LOW BUZZER  :PAUSE 2
GOTO START1
ENDIF
GOTO GET_WIDTH

GET_KEY: 
PAUSE 50

IF UP_KEY = 0 THEN
HIGH BUZZER :PAUSE BUZZ_DELAY :LOW BUZZER  :PAUSE 2
UNIT = UNIT + 1
IF UNIT => 40 THEN UNIT = 40          'maximun no of times
ENDIF

PAUSE 50

IF DOWN_KEY = 0 THEN
HIGH BUZZER :PAUSE BUZZ_DELAY :LOW BUZZER  :PAUSE 2
IF UNIT =< 0 THEN
UNIT = 0
GOTO GET_KEY
ENDIF
UNIT = UNIT - 1
ENDIF

PAUSE 50

IF EXIT_KEY = 0 THEN
COUNT_EXIT = COUNT_EXIT + 1
IF COUNT_EXIT = 2 THEN
HIGH BUZZER :PAUSE BUZZ_DELAY :LOW BUZZER  :PAUSE 10
GOTO REMOVE
ENDIF
 ENDIF
RETURN


START1:
low FORWARD
LOW FINISHED : low WORKING_LED
LCDOUT $FE,1 ' CLEAR SCREEN

START:
PAUSE 2
LCDOUT "LENGTH(S): " , DEC2 L_UNIT ," CM"
LCDOUT $FE, $C0 : LCDOUT "WIDTH(S) : " , DEC2 W_UNIT ," CM" : PAUSE 1200
LCDOUT $FE,1 ' CLEAR SCREEN

FOR COUNTOK = 0 TO 10
LCDOUT "    PRESS OK    "
LCDOUT $FE, $C0 : LCDOUT "  TO  CONTINUE  ": PAUSE 120
IF OK_KEY = 0 THEN
HIGH BUZZER :PAUSE BUZZ_DELAY :LOW BUZZER  :PAUSE 3000
GOTO RUN
ENDIF
NEXT COUNTOK 
LCDOUT $FE,1 ' CLEAR SCREEN

FOR COUNTEXIT = 0 TO 10
LCDOUT "   PRESS EXIT   "
LCDOUT $FE, $C0 : LCDOUT "   TO  CANCEL   ": PAUSE 120
IF EXIT_KEY = 0 THEN
HIGH BUZZER :PAUSE BUZZ_DELAY :LOW BUZZER  :PAUSE 10
GOTO MEASURE
ENDIF
NEXT COUNTEXIT
LCDOUT $FE,1 ' CLEAR SCREEN

GOTO START

RUN:
LCDOUT $FE,1 ' CLEAR SCREEN
PAUSE 2  : UNIT = 0
LCDOUT "  PRESS OK !!!  "

GET_RUN:
pause 10 : GOSUB GET_KEY
LCDOUT $FE, $C0 : LCDOUT "COUNT: " , DEC2 UNIT ," TIMES"
IF OK_KEY = 0 THEN              
RUN_UNIT = UNIT
HIGH BUZZER :PAUSE BUZZ_DELAY :LOW BUZZER  :PAUSE 2
LCDOUT $FE,1 ' CLEAR SCREEN
GOTO LAMINATE
ENDIF
GOTO GET_RUN

LAMINATE :             ' laminating starts here
LOW FINISHED : high WORKING_LED  : LOW FORWARD
PAUSE 1500
LCDOUT $FE,1 ' CLEAR SCREEN
IF RUN_UNIT < 1 THEN GOTO DONE
LCDOUT "<<< WORKING. >>>"
LOW FINISHED : HIGH WORKING_LED
HIGH BUZZER :PAUSE BUZZ_DELAY :LOW BUZZER  :PAUSE 3000
HIGH FORWARD :  PAUSE 4000
HIGH BUZZER :PAUSE BUZZ_DELAY :LOW BUZZER  :PAUSE 2
LOW FORWARD : PAUSE 4000

'|||||||||||||||||||||||||||||||||||||||||||||||||
'    CALCULATE  MOVEMENT
L_UNIT = L_UNIT - 1
A = 1580 * L_UNIT
B = 1000
'||||||||||||||||||||||||||||||||||||||||||||||||

RUN_LAMINATE:

FOR COUNTRUN = 1 TO RUN_UNIT
LCDOUT "<<< WORKING. >>>"
LCDOUT $FE, $C0 : LCDOUT "COUNT ON : " , DEC2 COUNTRUN,"/",dec2 RUN_UNIT
IF EXIT_KEY = 0 THEN
HIGH BUZZER :PAUSE BUZZ_DELAY :LOW BUZZER  :PAUSE 2
LCDOUT $FE,1 ' CLEAR SCREEN                        
UNIT = 0
L_UNIT = 0
W_UNIT = 0
R_UNIT = 0
LCDOUT $FE, $C0 : LCDOUT " TASK CANCELLED " : PAUSE 2500
GOTO MEASURE
ENDIF

MOVE_FORWARD:                     
HIGH FORWARD : PAUSE A
LOW FORWARD  : PAUSE B

MOVE_BACKWARD:
HIGH BACKWARD : PAUSE A
LOW BACKWARD  : PAUSE B

LCDOUT $FE,1 ' CLEAR SCREEN
pause 1000
NEXT COUNTRUN

REMOVE:
L0 = 0
LOW FINISHED : high WORKING_LED  : LOW FORWARD
PAUSE 800
LCDOUT $FE,1 ' CLEAR SCREEN
PAUSE 200
HIGH BACKWARD
LCDOUT " PLEASE WAIT !!!"
LCDOUT $FE, $C0 : LCDOUT " EJECTING BOARD "
    for L0 = 0 to 12  ' BLINK  AND ROLL BACK DELAY
        lcdout $fe,$8
        pause 450
        lcdout $fe,$c
        pause 500
     next L0
       LOW BACKWARD
       pause 500
COUNT_EXIT = 0    :L0 = 0
COUNTOK = 0  : COUNTEXIT = 0
LCDOUT $FE,1 ' CLEAR SCREEN



DONE:
HIGH BUZZER : PAUSE BUZZ_DELAY : LOW BUZZER  :PAUSE 300
HIGH FINISHED : LOW WORKING_LED : low FORWARD
'LCDOUT "  PRESS EXIT!!! "
LCDOUT " TASK COMPLETED "
HIGH BACKWARD

FOR COUNTOK = 0 TO 10
LCDOUT $FE, $C0 : LCDOUT " <<OK>> TO REDO ": PAUSE 120
IF OK_KEY = 0 THEN
HIGH BUZZER :PAUSE BUZZ_DELAY :LOW BUZZER  :PAUSE 1200
LOW BACKWARD
PAUSE 1000
LOW FORWARD
PAUSE 2000
L_UNIT = L_UNIT + 1
GOTO LAMINATE        ' LAMINATED AGAIN
ENDIF
NEXT COUNTOK 

FOR COUNTEXIT = 0 TO 10
LCDOUT $FE, $C0 : LCDOUT "<EXIT> TO CANCEL": PAUSE 120
IF EXIT_KEY = 0 THEN
HIGH BUZZER :PAUSE BUZZ_DELAY :LOW BUZZER  :PAUSE 1200
LOW BACKWARD
UNIT = 0
L_UNIT = 0
W_UNIT = 0
R_UNIT = 0
PAUSE 1000
LOW FINISHED : low WORKING_LED  : HIGH FORWARD   : PAUSE 1000
LCDOUT $FE,1 ' CLEAR SCREEN
PAUSE 300 : GOTO MEASURE
ENDIF
NEXT COUNTEXIT 

GOTO DONE

END



CODE: https://www.dropbox.com/s/ewoa62jzrqusc7a/laminate%20code.txt?dl=0

HEX: https://onedrive.live.com/redir?resid=7B2431F2BDE45654!110&authkey=!AMetcTYhV7fHyUw&ithint=file%2cHEX

PCB:  https://onedrive.live.com/redir?resid=7B2431F2BDE45654!108&authkey=!AByhjoC4T7mEsf4&ithint=file%2cpdf


Featured post

PURE SINE WAVE INVERTER WITH LED AND LCD

The inverter PCB is easy to assemble by following the label of the components to be inserted. The choice of the voltage to be used to power ...