PWM to RS232 Camera Zoom

I have found some code written for Atmel ATmega8535 that is for PWM to RS232 zoom function on a VK-914 camera. What would I have to do to use this code with the Arduino Duemilanove? What language is this written in? Basic?

’ *********************************************************************************** ’ * * ’ * Title : VK-S274 & VK-S274R SERIES Hitachi Block Camera Controller * ’ * Version : 1.1 Beta * ’ * Last Updated : 02.12.2008 * ’ * Target Device : ATMEGA8535 * ’ * Author : Farmtech & Neptune769 * ’ * Support : Try Skype Name : farmtech_dk or in MCS Bascom Forum * ’ * Program code : BASCOM AVR * ’ * Hardware req. : VK-S274 or VK-S274R SERIES Hitachi Block Camera * ’ * Description : Control : Zoom - Focus & Iris Via Serialport on Camera * ’ * Baud for camera : 4800.8.E.1 : Even Parity default for camera * ’ * : 9600.8.N.1 but need setup in Camera (:WE05EF0) * ’ * *********************************************************************************** $regfile = “m8535.dat” $crystal = 8000000 $hwstack = 40 $swstack = 30 $framesize = 60 Open “comd.2:4800,8,e,1” For Output As #1 ’ 4800 bps , even Parity ; default for camera 'Config Ports for the 6 buttons n PortC we use buttons to GND Config Portc.0 = Input : Set Portc.0 'Zoom NEAR Button Config Portc.1 = Input : Set Portc.1 'Zoom FAR Button Config Portc.2 = Input : Set Portc.2 'Focus NEAR Button IN Config Portc.3 = Input : Set Portc.3 'Focus FAR Button OUT Config Portc.4 = Input : Set Portc.4 'Iris offset (average) + Button Config Portc.5 = Input : Set Portc.5 'Iris offset (average) - Button Config Portc.6 = Input : Set Portc.6 'Freeze ON / OFF Toggle Button 'Config Portc.7 = Input : Set Portc.7 'not used yet Button Dim I As Byte , Irish As Byte , Irisl As Byte , Irisavg As Byte , Freezebit As Byte 'Print Version() 'setup Camera Print #1 , “:WFCCB01” ’ Switch the continuous digital zoom ON Waitms 10 Print #1 , “:WFDFC10” ’ Zoom speed normal Waitms 10 Print #1 , “:WFCCB40” ’ Switch the instant digital zoom ON Waitms 10 Print #1 , “:WFCBBA8” ’ Auto focus ON allways (not on manual Focus) 'setup Iris offset (average) level Irisavg = &H40 ’ Iris is normal hex 40 i hope Irish = 0 ’ Bit set for Iris to HIGH Irisl = 0 ’ Bit set for Iris to LOW Freezebit = 0 ’ togglebit for freez images Wait 1 'The main program Do If Pinc.0 = 0 Then Print #1 , “:WFCBB99” ’ zoom near Bitwait Pinc.0 , Set ’ wait for button relace Print #1 , “:WFCBBFE” ’ stop Print #1 , “:WFCBBA8” ’ Auto focus on Waitms 300 ’ wait for auto zoom to get focus End If If Pinc.1 = 0 Then Print #1 , “:WFCBB9B” ’ zoom far Bitwait Pinc.1 , Set ’ wait for button relace Print #1 , “:WFCBBFE” ’ stop Print #1 , “:WFCBBA8” ’ Auto focus on Waitms 300 ’ wait for auto zoom to get focus End If If Pinc.2 = 0 Then Print #1 , “:WFCBBFE” ’ Auto focus off Print #1 , “:WFCBBAA” ’ focus near Bitwait Pinc.2 , Set ’ wait for button relace Print #1 , “:WFCBBFE” ’ stop End If If Pinc.3 = 0 Then Print #1 , “:WFCBBFE” ’ Auto focus off Print #1 , “:WFCBBA9” ’ focus far Bitwait Pinc.3 , Set ’ wait for button relace Print #1 , “:WFCBBFE” ’ stop End If 'Iris offset (average) level + Open If Pinc.4 = 0 And Irish = 0 Then 'if pinc.4 and irisbit high is 0 else skip Irisl = 0 ’ reset to low bit I = Irisavg + 1 ’ to start from known pos For I = Irisavg To 255 ’ Irisavg to High 00 - FF Print #1 , “:WFD9E” ; Hex(i) 'Iris offset (average) send Irisavg = I ’ put I count into Irisavg If I = 255 Then ’ If MAX Iris then exit for Irish = 1 ’ Set Iris bit TO high so it dont do the OPEN until you have closed it a bit Exit For End If If Pinc.4 = 1 Then Exit For ’ check for button relace Next ’ next i End If 'Iris offset (average) level - Close If Pinc.5 = 0 And Irisl = 0 Then ’ if pinc.5 and irisbit low is 0 else skip Irish = 0 ’ reset to high bit I = Irisavg ’ to start from known pos For I = Irisavg To 0 Step -1 ’ from Irisavg to MIN FF - 00 Print #1 , “:WFD9E” ; Hex(i) ’ Iris offset (average) send Irisavg = I ’ put I count into Irisavg If I = 0 Then ’ If MIN Iris then exit for Irisl = 1 ’ Set Iris bit TO low so it dont do the CLOSE until you have open it a bit Exit For End If If Pinc.5 = 1 Then Exit For ’ check for button relace Next ’ next i End If If Pinc.6 = 0 And Freezebit = 0 Then Print #1 , “:WFF3301” 'Freeze Field ON Freezebit = 1 'set freezebit to freeze OFF Bitwait Pinc.6 , Set ’ check for button relace End If If Pinc.6 = 0 And Freezebit = 1 Then Print #1 , “:WFF3300” 'Freeze OFF Freezebit = 0 'set freezebit to freeze ON Bitwait Pinc.6 , Set ’ check for button relace End If 'If Pinc.7 = 0 Then ’ Print #1 , “:” 'not used yet ’ Bitwait Pinc.7 , Set 'End If Loop Close #1 End

Cleaning it up and/or using the code "#" button in the "post reply" editor would help us understand it better...

:)

Sorry I have been very busy....' *********************************************************************************** ' * * ' * Title : VK-S274 & VK-S274R SERIES Hitachi Block Camera Controller * ' * Version : 1.1 Beta * ' * Last Updated : 02.12.2008 * ' * Target Device : ATMEGA8535 * ' * Author : Farmtech & Neptune769 * ' * Support : Try Skype Name : farmtech_dk or in MCS Bascom Forum * ' * Program code : BASCOM AVR * ' * Hardware req. : VK-S274 or VK-S274R SERIES Hitachi Block Camera * ' * Description : Control : Zoom - Focus & Iris Via Serialport on Camera * ' * Baud for camera : 4800.8.E.1 : Even Parity default for camera * ' * : 9600.8.N.1 but need setup in Camera (:WE05EF0) * ' * * ' * More Commands : See Datasheet lots of other stuff you can do. * ' * * ' * Datasheet : http://www.data-sheet.net/Vk-s454+ebook+pdf.html * ' * : http://ip.gliebetronics.com:800/hitachi/S274R_Comm_E11.pdf * ' * * ' * Copyright : None use it as you like * ' * * ' *********************************************************************************** $regfile = "m8535.dat" $crystal = 8000000 $hwstack = 40 $swstack = 30 $framesize = 60 Open "comd.2:4800,8,e,1" For Output As #1 ' 4800 bps , even Parity ; default for camera 'Config Ports for the 6 buttons n PortC we use buttons to GND Config Portc.0 = Input : Set Portc.0 'Zoom NEAR Button Config Portc.1 = Input : Set Portc.1 'Zoom FAR Button Config Portc.2 = Input : Set Portc.2 'Focus NEAR Button IN Config Portc.3 = Input : Set Portc.3 'Focus FAR Button OUT Config Portc.4 = Input : Set Portc.4 'Iris offset (average) + Button Config Portc.5 = Input : Set Portc.5 'Iris offset (average) - Button Config Portc.6 = Input : Set Portc.6 'Freeze ON / OFF Toggle Button 'Config Portc.7 = Input : Set Portc.7 'not used yet Button Dim I As Byte , Irish As Byte , Irisl As Byte , Irisavg As Byte , Freezebit As Byte 'Print Version() 'setup Camera Print #1 , ":WFCCB01" ' Switch the continuous digital zoom ON Waitms 10 Print #1 , ":WFDFC10" ' Zoom speed normal Waitms 10 Print #1 , ":WFCCB40" ' Switch the instant digital zoom ON Waitms 10 Print #1 , ":WFCBBA8" ' Auto focus ON allways (not on manual Focus) 'setup Iris offset (average) level Irisavg = &H40 ' Iris is normal hex 40 i hope Irish = 0 ' Bit set for Iris to HIGH Irisl = 0 ' Bit set for Iris to LOW Freezebit = 0 ' togglebit for freez images Wait 1 'The main program Do If Pinc.0 = 0 Then Print #1 , ":WFCBB99" ' zoom near Bitwait Pinc.0 , Set ' wait for button relace Print #1 , ":WFCBBFE" ' stop Print #1 , ":WFCBBA8" ' Auto focus on Waitms 300 ' wait for auto zoom to get focus End If If Pinc.1 = 0 Then Print #1 , ":WFCBB9B" ' zoom far Bitwait Pinc.1 , Set ' wait for button relace Print #1 , ":WFCBBFE" ' stop Print #1 , ":WFCBBA8" ' Auto focus on Waitms 300 ' wait for auto zoom to get focus End If If Pinc.2 = 0 Then Print #1 , ":WFCBBFE" ' Auto focus off Print #1 , ":WFCBBAA" ' focus near Bitwait Pinc.2 , Set ' wait for button relace Print #1 , ":WFCBBFE" ' stop End If If Pinc.3 = 0 Then Print #1 , ":WFCBBFE" ' Auto focus off Print #1 , ":WFCBBA9" ' focus far Bitwait Pinc.3 , Set ' wait for button relace Print #1 , ":WFCBBFE" ' stop End If 'Iris offset (average) level + Open If Pinc.4 = 0 And Irish = 0 Then 'if pinc.4 and irisbit high is 0 else skip Irisl = 0 ' reset to low bit I = Irisavg + 1 ' to start from known pos For I = Irisavg To 255 ' Irisavg to High 00 - FF Print #1 , ":WFD9E" ; Hex(i) 'Iris offset (average) send Irisavg = I ' put I count into Irisavg If I = 255 Then ' If MAX Iris then exit for Irish = 1 ' Set Iris bit TO high so it dont do the OPEN until you have closed it a bit Exit For End If If Pinc.4 = 1 Then Exit For ' check for button relace Next ' next i End If 'Iris offset (average) level - Close If Pinc.5 = 0 And Irisl = 0 Then ' if pinc.5 and irisbit low is 0 else skip Irish = 0 ' reset to high bit I = Irisavg ' to start from known pos For I = Irisavg To 0 Step -1 ' from Irisavg to MIN FF - 00 Print #1 , ":WFD9E" ; Hex(i) ' Iris offset (average) send Irisavg = I ' put I count into Irisavg If I = 0 Then ' If MIN Iris then exit for Irisl = 1 ' Set Iris bit TO low so it dont do the CLOSE until you have open it a bit Exit For End If If Pinc.5 = 1 Then Exit For ' check for button relace Next ' next i End If If Pinc.6 = 0 And Freezebit = 0 Then Print #1 , ":WFF3301" 'Freeze Field ON Freezebit = 1 'set freezebit to freeze OFF Bitwait Pinc.6 , Set ' check for button relace End If If Pinc.6 = 0 And Freezebit = 1 Then Print #1 , ":WFF3300" 'Freeze OFF Freezebit = 0 'set freezebit to freeze ON Bitwait Pinc.6 , Set ' check for button relace End If 'If Pinc.7 = 0 Then ' Print #1 , ":" 'not used yet ' Bitwait Pinc.7 , Set 'End If Loop Close #1 End

It is all still on one line.

It is extremely hard to read like that, try splitting it up, and we might have a chance to see what it is :)

A little googling turned up the below, which is probably a good place to start.

http://nemocam.com/media//DIR_13911/COM_914.pdf

BTW - Yes, that code is a variant of "BASIC"; I first I thought "QuickBASIC", but a little more reading makes me believe it is PicBasic or PBASIC (for the Parallax Basic Stamp). It shouldn't be too difficult to convert. But you need to post cleaner code!

:)

So this is a link to the website where this code is referenced. http://nemocam.com/6294.html

Here is a direct link to the code http://nemocam.com/media/VK-S274_Ver_1$5B1$5D.1.bas

This was written in Bascom according to the author of the code, how should I clean it up? I know some java and none of what ever this language is written in :-[ I can't even tell where one command starts and one stops. I have downloaded bascom, but that did not help. The code looks no better then being posted here.

Not sure if this is any better?

' ***********************************************************************************
' * * ' * Title : VK-S274 & VK-S274R SERIES Hitachi Block Camera Controller *
' * Version : 1.1 Beta * 
' * Last Updated : 02.12.2008 * 
' * Target Device : ATMEGA8535 * 
' * Author : Farmtech & Neptune769 * 
' * Support : Try Skype Name : farmtech_dk or in MCS Bascom Forum * 
' * Program code : BASCOM AVR * 
' * Hardware req. : VK-S274 or VK-S274R SERIES Hitachi Block Camera * 
' * Description : Control : Zoom - Focus & Iris Via Serialport on Camera * 
' * Baud for camera : 4800.8.E.1 : Even Parity default for camera * 
' * : 9600.8.N.1 but need setup in Camera (:WE05EF0) * 
' * * 
' * More Commands : See Datasheet lots of other stuff you can do. * 
' * * 
' * Datasheet : http://www.data-sheet.net/Vk-s454+ebook+pdf.html * 
' * : http://ip.gliebetronics.com:800/hitachi/S274R_Comm_E11.pdf * 
' * * 
' * Copyright : None use it as you like * 
' * * 
' *********************************************************************************** 
$regfile = "m8535.dat" $crystal = 8000000 $hwstack = 40 $swstack = 30 $framesize = 60 Open "comd.2:4800,8,e,1" For Output As #1 ' 
4800 bps , even Parity ; default for camera '
Config Ports for the 6 buttons n PortC we use buttons to GND Config Portc.0 = Input : Set Portc.0 '
Zoom NEAR Button Config Portc.1 = Input : Set Portc.1 '
Zoom FAR Button Config Portc.2 = Input : Set Portc.2 '
Focus NEAR Button IN Config Portc.3 = Input : Set Portc.3 '
Focus FAR Button OUT Config Portc.4 = Input : Set Portc.4 '
Iris offset (average) + Button Config Portc.5 = Input : Set Portc.5 '
Iris offset (average) - Button Config Portc.6 = Input : Set Portc.6 '
Freeze ON / OFF Toggle Button '
Config Portc.7 = Input : Set Portc.7 '
not used yet Button Dim I As Byte , Irish As Byte , Irisl As Byte , Irisavg As Byte , Freezebit As Byte '
Print Version() '
setup Camera Print #1 , ":WFCCB01" ' 
Switch the continuous digital zoom ON Waitms 10 Print #1 , ":WFDFC10" ' 
Zoom speed normal Waitms 10 Print #1 , ":WFCCB40" ' 
Switch the instant digital zoom ON Waitms 10 Print #1 , ":WFCBBA8" ' 
Auto focus ON allways (not on manual Focus) '
setup Iris offset (average) level Irisavg = &H40 ' 
Iris is normal hex 40 i hope Irish = 0 ' 
Bit set for Iris to HIGH Irisl = 0 ' 
Bit set for Iris to LOW Freezebit = 0 ' 
togglebit for freez images Wait 1 '
The main program Do If Pinc.0 = 0 Then Print #1 , ":WFCBB99" ' 
zoom near Bitwait Pinc.0 , Set ' 
wait for button relace Print #1 , ":WFCBBFE" ' 
stop Print #1 , ":WFCBBA8" ' 
Auto focus on Waitms 300 ' 
wait for auto zoom to get focus End If If Pinc.1 = 0 Then Print #1 , ":WFCBB9B" ' 
zoom far Bitwait Pinc.1 , Set ' 
wait for button relace Print #1 , ":WFCBBFE" ' 
stop Print #1 , ":WFCBBA8" ' 
Auto focus on Waitms 300 ' 
wait for auto zoom to get focus End If If Pinc.2 = 0 Then Print #1 , ":WFCBBFE" ' 
Auto focus off Print #1 , ":WFCBBAA" ' 
focus near Bitwait Pinc.2 , Set ' 
wait for button relace Print #1 , ":WFCBBFE" ' 
stop End If If Pinc.3 = 0 Then Print #1 , ":WFCBBFE" ' 
Auto focus off Print #1 , ":WFCBBA9" ' 
focus far Bitwait Pinc.3 , Set ' 
wait for button relace Print #1 , ":WFCBBFE" ' 
stop End If 'Iris offset (average) level + Open If Pinc.4 = 0 And Irish = 0 Then '
if pinc.4 and irisbit high is 0 else skip Irisl = 0 ' 
reset to low bit I = Irisavg + 1 ' 
to start from known pos For I = Irisavg To 255 ' 
Irisavg to High 00 - FF Print #1 , ":WFD9E" ; Hex(i) '
Iris offset (average) send Irisavg = I ' 
put I count into Irisavg If I = 255 Then ' 
If MAX Iris then exit for Irish = 1 ' 
Set Iris bit TO high so it dont do the OPEN until you have closed it a bit Exit For End If If Pinc.4 = 1 Then Exit For ' 
check for button relace Next ' 
next i End If '
Iris offset (average) level - Close If Pinc.5 = 0 And Irisl = 0 Then ' 
if pinc.5 and irisbit low is 0 else skip Irish = 0 ' 
reset to high bit I = Irisavg ' 
to start from known pos For I = Irisavg To 0 Step -1 ' 
from Irisavg to MIN FF - 00 Print #1 , ":WFD9E" ; Hex(i) ' 
Iris offset (average) send Irisavg = I ' 
put I count into Irisavg If I = 0 Then ' 
If MIN Iris then exit for Irisl = 1 ' 
Set Iris bit TO low so it dont do the CLOSE until you have open it a bit Exit For End If If Pinc.5 = 1 Then Exit For ' 
check for button relace Next ' 
next i End If If Pinc.6 = 0 And Freezebit = 0 Then Print #1 , ":WFF3301" '
Freeze Field ON Freezebit = 1 '
set freezebit to freeze OFF Bitwait Pinc.6 , Set ' 
check for button relace End If If Pinc.6 = 0 And Freezebit = 1 Then Print #1 , ":WFF3300" '
Freeze OFF Freezebit = 0 '
set freezebit to freeze ON Bitwait Pinc.6 , Set ' 
check for button relace End If '
If Pinc.7 = 0 Then ' 
Print #1 , ":" '
not used yet ' 
Bitwait Pinc.7 , Set '
End If Loop Close #1 End

This is as close as I can come to it (and without knowing BASCOM):

' ***********************************************************************************
' *                                                                                 * 
' * Title : VK-S274 & VK-S274R SERIES Hitachi Block Camera Controller               *
' * Version : 1.1 Beta                                                              *
' * Last Updated : 02.12.2008                                                       *
' * Target Device : ATMEGA8535                                                      *
' * Author : Farmtech & Neptune769                                                  *
' * Support : Try Skype Name : farmtech_dk or in MCS Bascom Forum                   *
' * Program code : BASCOM AVR                                                       *
' * Hardware req. : VK-S274 or VK-S274R SERIES Hitachi Block Camera                 *
' * Description : Control : Zoom - Focus & Iris Via Serialport on Camera            *
' * Baud for camera :       4800.8.E.1 : Even Parity default for camera             *
' *                       : 9600.8.N.1 but need setup in Camera (:WE05EF0)          *
' *                                                                                 *
' * More Commands : See Datasheet lots of other stuff you can do.                   *
' *                                                                                 *
' * Datasheet : http://www.data-sheet.net/Vk-s454+ebook+pdf.html                    *
' *             http://ip.gliebetronics.com:800/hitachi/S274R_Comm_E11.pdf          *
' *                                                                                 *
' * Copyright : None use it as you like                                             *
' *                                                                                 *
' ***********************************************************************************

$regfile = "m8535.dat" 
$crystal = 8000000 
$hwstack = 40 
$swstack = 30 
$framesize = 60 

Open "comd.2:4800,8,e,1" For Output As #1 '4800 bps , even Parity ; default for camera 

'Config Ports for the 6 buttons n PortC we use buttons to GND 
Config Portc.0 = Input : Set Portc.0 'Zoom NEAR Button 
Config Portc.1 = Input : Set Portc.1 'Zoom FAR Button 
Config Portc.2 = Input : Set Portc.2 'Focus NEAR Button IN 
Config Portc.3 = Input : Set Portc.3 'Focus FAR Button OUT 
Config Portc.4 = Input : Set Portc.4 'Iris offset (average) + Button 
Config Portc.5 = Input : Set Portc.5 'Iris offset (average) - Button 
Config Portc.6 = Input : Set Portc.6 'Freeze ON / OFF Toggle Button 
Config Portc.7 = Input : Set Portc.7 'not used yet Button 

Dim I As Byte , Irish As Byte , Irisl As Byte , Irisavg As Byte , Freezebit As Byte '

Print Version() 

'setup Camera 
Print #1 , ":WFCCB01" 'Switch the continuous digital zoom ON 
Waitms 10 
Print #1 , ":WFDFC10" 'Zoom speed normal 
Waitms 10 
Print #1 , ":WFCCB40" 'Switch the instant digital zoom ON 
Waitms 10 
Print #1 , ":WFCBBA8" 'Auto focus ON allways (not on manual Focus) 
'setup Iris offset (average) level 
Irisavg = &H40 'Iris is normal hex 40 i hope 
Irish = 0 'Bit set for Iris to HIGH 
Irisl = 0 'Bit set for Iris to LOW 
Freezebit = 0 ' togglebit for freez images 
Wait 1 

' The main program 
Do 
  If Pinc.0 = 0 Then 
    Print #1 , ":WFCBB99" 'zoom near 
    Bitwait Pinc.0 , Set 'wait for button relace 
    Print #1 , ":WFCBBFE" 'stop 
    Print #1 , ":WFCBBA8" 'Auto focus on 
    Waitms 300 'wait for auto zoom to get focus 
  End If 

  If Pinc.1 = 0 Then 
    Print #1 , ":WFCBB9B" 'zoom far 
    Bitwait Pinc.1 , Set 'wait for button relace 
    Print #1 , ":WFCBBFE" 'stop 
    Print #1 , ":WFCBBA8" 'Auto focus on 
    Waitms 300 'wait for auto zoom to get focus 
  End If 
  
  If Pinc.2 = 0 Then 
    Print #1 , ":WFCBBFE" 'Auto focus off 
    Print #1 , ":WFCBBAA" 'focus near 
    Bitwait Pinc.2 , Set 'wait for button relace 
    Print #1 , ":WFCBBFE" 'stop 
  End If 

  If Pinc.3 = 0 Then 
    Print #1 , ":WFCBBFE" 'Auto focus off 
    Print #1 , ":WFCBBA9" 'focus far 
    Bitwait Pinc.3 , Set 'wait for button relace 
    Print #1 , ":WFCBBFE" 'stop 
  End If 

  'Iris offset (average) level + Open 
  If Pinc.4 = 0 And Irish = 0 Then 'if pinc.4 and irisbit high is 0 else skip 
    Irisl = 0 'reset to low bit 
    I = Irisavg + 1 'to start from known pos 
    For I = Irisavg To 255 'Irisavg to High 00 - FF 
      Print #1 , ":WFD9E" ; Hex(i) 'Iris offset (average) send 
      Irisavg = I 'put I count into Irisavg 
      If I = 255 Then 'If MAX Iris then exit for 
        Irish = 1 'Set Iris bit TO high so it dont do the OPEN until you have closed it a bit 
        Exit For 
      End If 
      If Pinc.4 = 1 Then Exit For 'check for button relace 
    Next 'next i 
  End If 

  'Iris offset (average) level - Close 
  If Pinc.5 = 0 And Irisl = 0 Then 'if pinc.5 and irisbit low is 0 else skip 
    Irish = 0 'reset to high bit 
    I = Irisavg 'to start from known pos 
    For I = Irisavg To 0 Step -1 'from Irisavg to MIN FF - 00 
      Print #1 , ":WFD9E" ; Hex(i) 'Iris offset (average) send 
      Irisavg = I 'put I count into Irisavg 
      If I = 0 Then 'If MIN Iris then exit for 
        Irisl = 1 'Set Iris bit TO low so it dont do the CLOSE until you have open it a bit 
        Exit For 
      End If 
      If Pinc.5 = 1 Then Exit For 'check for button relace 
    Next 'next i 
  End If 

  If Pinc.6 = 0 And Freezebit = 0 Then 
    Print #1 , ":WFF3301" 'Freeze Field ON 
    Freezebit = 1 'set freezebit to freeze OFF 
    Bitwait Pinc.6 , Set 'check for button relace 
  End If 
  
  If Pinc.6 = 0 And Freezebit = 1 Then 
    Print #1 , ":WFF3300" 'Freeze OFF 
    Freezebit = 0 'set freezebit to freeze ON 
    Bitwait Pinc.6 , Set 'check for button relace 
  End If

  If Pinc.7 = 0 Then 
    'Print #1 , ":" 'not used yet 
    'Bitwait Pinc.7 , Set 
  End If 
Loop 

Close #1 

End

Hope it helps!

:)