⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 se516v36.bas

📁 C51单片机的程序下载器软件源代码
💻 BAS
📖 第 1 页 / 共 4 页
字号:
     Set P16_o_805x_prog_n                          ' Prog Low
     Set P16_o_805x_prog_n                          ' Prog Low
     Reset P16_o_805x_prog_n                        ' Prog High
     Reset P16_o_805x_prog_n                        ' Prog High
     Reset P16_o_805x_prog_n                        ' Prog High
     Reset P16_o_805x_prog_n                        ' Prog High

     Bitwait P33_i_805x_p34_busy_n , Set
     Set P34_o_805x_vpp_n                           ' Vpp = + 5V
     Waitms 1
Return
'----------------------------------------------------------------------------------------------------------
Lock_bit_805x:
' INPUT  :
' OUTPUT : F
'
     Gosub Preset_805x

     If S = "A" Then
       Set P26_o_805x_p26_mode_d                    ' 805X P2.6 LB1
       Set P27_o_805x_p27_mode_c                    ' 805X P2.7
       Set P11_o_805x_p36_mode_b                    ' 805X P3.6
       Set P12_o_805x_p37_mode_a                    ' 805X P3.7
       Gosub Prog_pulse_out_805x
       F = "A"
     End If

     If S = "B" Then
       Set P26_o_805x_p26_mode_d                    ' 805X P2.6 LB2
       Set P27_o_805x_p27_mode_c                    ' 805X P2.7
       Reset P11_o_805x_p36_mode_b                  ' 805X P3.6
       Reset P12_o_805x_p37_mode_a                  ' 805X P3.7
       Gosub Prog_pulse_out_805x
       F = "B"
     End If

     If S = "C" Then
       Set P26_o_805x_p26_mode_d                    ' 805X P2.6 LB3
       Reset P27_o_805x_p27_mode_c                  ' 805X P2.7
       Set P11_o_805x_p36_mode_b                    ' 805X P3.6
       Reset P12_o_805x_p37_mode_a                  ' 805X P3.7
       Gosub Prog_pulse_out_805x
       F = "C"
     End If

     Gosub Simulation_805x

Return
'----------------------------------------------------------------------------------------------------------
Lock_bit_8252:
' INPUT  :
' OUTPUT : F
'
     Gosub Preset_805x

     Set P26_o_805x_p26_mode_d                      ' 805X P2.6
     Reset P27_o_805x_p27_mode_c                    ' 805X P2.7
     Set P11_o_805x_p36_mode_b                      ' 805X P3.6
     Reset P12_o_805x_p37_mode_a                    ' 805X P3.7

     If S = "A" Then
       P0 = &H7F
     End If

     If S = "B" Then
       P0 = &HBF
     End If

     If S = "C" Then
       P0 = &HDF
     End If

     Reset P34_o_805x_vpp_n                         ' Vpp = + 12V
     Waitms 1
     Set P16_o_805x_prog_n                          ' Prog Low
     Set P16_o_805x_prog_n                          ' Prog Low
     Set P16_o_805x_prog_n                          ' Prog Low
     Set P16_o_805x_prog_n                          ' Prog Low
     Reset P16_o_805x_prog_n                        ' Prog High
     Reset P16_o_805x_prog_n                        ' Prog High
     Reset P16_o_805x_prog_n                        ' Prog High
     Reset P16_o_805x_prog_n                        ' Prog High

     Bitwait P33_i_805x_p34_busy_n , Set
     Waitms 1

     Set P26_o_805x_p26_mode_d                      ' 805X P2.6
     Set P27_o_805x_p27_mode_c                      ' 805X P2.7
     Reset P11_o_805x_p36_mode_b                    ' 805X P3.6
     Reset P12_o_805x_p37_mode_a                    ' 805X P3.7

     R = P0
     Set P34_o_805x_vpp_n                           ' Vpp = + 5V

     If S = "A" Then
       R = R And &B00000100
       If R = 0 Then
         F = "A"
       Else
         F = "a"
       End If
     End If

     If S = "B" Then
       R = R And &B00000010
       If R = 0 Then
         F = "B"
       Else
         F = "b"
       End If
     End If

     If S = "C" Then
       R = R And &B00000001
       If R = 0 Then
         F = "C"
       Else
         F = "c"
       End If
     End If

     Gosub Simulation_805x

Return
'----------------------------------------------------------------------------------------------------------
Lock_pulse_s5x_c55wd:

       If Device_code = At89c55wd Then
          Set P13_o_805x_wd_vcc                     ' AT89C55WD Vcc Up(6.5v)
       End If

       Reset P34_o_805x_vpp_n                       ' Vpp = + 12V
       Waitms 10
       Set P16_o_805x_prog_n                        ' Prog Low
       Delay
       Delay
       Reset P16_o_805x_prog_n                      ' Prog High

       Set P34_o_805x_vpp_n                         ' Vpp = + 5V
       Reset P13_o_805x_wd_vcc                      ' AT89C55WD Vcc (5.0v)
       Waitms 20                                    ' 20 mSec Delay

       Reset P32_o_805x_p33_mode_e                  ' 805X P3.3
       Set P26_o_805x_p26_mode_d                    ' 805X P2.6
       Set P27_o_805x_p27_mode_c                    ' 805X P2.7
       Set P11_o_805x_p36_mode_b                    ' 805X P3.6
       Reset P12_o_805x_p37_mode_a                  ' 805X P3.7
       Delay

       R = P0

       Set P32_o_805x_p33_mode_e                    ' 805X P3.3
       Set P12_o_805x_p37_mode_a                    ' 805X P3.7

Return
'----------------------------------------------------------------------------------------------------------
Lock_bit_s5x_c55wd:
' INPUT  :
' OUTPUT : F
'
     Gosub Preset_805x

     If S = "A" Then
       Set P32_o_805x_p33_mode_e                    ' 805X P3.3
       Set P26_o_805x_p26_mode_d                    ' 805X P2.6
       Set P27_o_805x_p27_mode_c                    ' 805X P2.7
       Set P11_o_805x_p36_mode_b                    ' 805X P3.6
       Set P12_o_805x_p37_mode_a                    ' 805X P3.7

       Gosub Lock_pulse_s5x_c55wd

       R = R And &B00000100

       If R = 0 Then
         F = "a"
       Else
         F = "A"
       End If

     End If

     If S = "B" Then
       Set P32_o_805x_p33_mode_e                    ' 805X P3.3
       Set P26_o_805x_p26_mode_d                    ' 805X P2.6
       Set P27_o_805x_p27_mode_c                    ' 805X P2.7
       Reset P11_o_805x_p36_mode_b                  ' 805X P3.6
       Reset P12_o_805x_p37_mode_a                  ' 805X P3.7

       Gosub Lock_pulse_s5x_c55wd

       R = R And &B00001000

       If R = 0 Then
         F = "b"
       Else
         F = "B"
       End If

     End If

     If S = "C" Then
       Set P32_o_805x_p33_mode_e                    ' 805X P3.3
       Set P26_o_805x_p26_mode_d                    ' 805X P2.6
       Reset P27_o_805x_p27_mode_c                  ' 805X P2.7
       Set P11_o_805x_p36_mode_b                    ' 805X P3.6
       Reset P12_o_805x_p37_mode_a                  ' 805X P3.7

       Gosub Lock_pulse_s5x_c55wd

       R = R And &B00010000

       If R = 0 Then
         F = "c"
       Else
         F = "C"
       End If

     End If

     Gosub Simulation_805x                          ' Simulation Mode

Return
'----------------------------------------------------------------------------------------------------------
Write_lock_bit:

      If Package_type = Cx051 Then
         Gosub Lock_bit_x051
      Else
         If Device_code = At89s8252 Then
               Gosub Lock_bit_8252
         Else

            If C5x_s5xc55wd = S5x_c55wd Then
               Gosub Lock_bit_s5x_c55wd
            Else
               Gosub Lock_bit_805x
            End If
         End If

      End If

Return
'----------------------------------------------------------------------------------------------------------
Read_code_x051:
' INPUT  :
' OUTPUT : F -> "R" / "r"
'
   Gosub Preset_x051

   Reset P12_o_x051_p33_mode_d                      ' X051 P3.3 L
   Reset P13_o_x051_p34_mode_c                      ' X051 P3.4 L
   Set P14_o_x051_p35_mode_b                        ' X051 P3.5 H
   Set P20_o_x051_p37_mode_a                        ' X051 P3.7 H

   Device_address = 0
   F = "R"

   While Device_address < Device_size

'/////////////////////////////////////////////
'//   Read Command from HOST Computer       //
'/////////////////////////////////////////////
      C = Waitkey
      If C <> "T" Then
         Exit While
      End If

      For I = 0 To 31                               ' Buffer Size
         Gosub Read_p1_x051                         ' R
         Printhex R;
         Set P36_system_clock                       ' X051 Xtal1 High
         Delay
         Reset P36_system_clock                     ' X051 Xtal1 Low
         Incr Device_address
      Next I

   Wend
   If C <> "T" Then
      F = "r"
   End If
   Gosub Simulation_x051

Return
'----------------------------------------------------------------------------------------------------------
Read_code_805x:
' INPUT  :
' OUTPUT : F -> "R" / "r"
'
     Gosub Preset_805x

     Reset P32_o_805x_p33_mode_e                    ' 805X P3.3
     Reset P26_o_805x_p26_mode_d                    ' 805X P2.6
     Reset P27_o_805x_p27_mode_c                    ' 805X P2.7
     Set P11_o_805x_p36_mode_b                      ' 805X P3.6
     Set P12_o_805x_p37_mode_a                      ' 805X P3.7

     Device_address = 0
     F = "R"

     If Device_code = At89s8252 Then                ' AT89S8252
        Reset P34_o_805x_vpp_n                      ' Vpp = +12V
        Waitms 10
     End If

     While Device_address < Device_size

'/////////////////////////////////////////////
'//   Read Command from HOST Computer       //
'/////////////////////////////////////////////

       C = Waitkey
       If C <> "T" Then
         Exit While
       End If

       For I = 0 To 31                              ' Buffer Size

         Set P27_o_805x_p27_mode_c                  ' 805X P2.7
         Gosub Address_line_set
         Reset P27_o_805x_p27_mode_c                ' 805X P2.7
         Delay
         R = P0
         Printhex R;
         Incr Device_address

       Next I

     Wend

     If C <> "T" Then
        F = "r"                                     ' Abort Reading Command
     End If

     Set P34_o_805x_vpp_n                           ' Vpp = +5V
     Waitms 100

     Gosub Simulation_805x                          ' Simulation Mode

Return
'----------------------------------------------------------------------------------------------------------
'  *** END OF FILE ***
'----------------------------------------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -