Sign In

I Face A Problem To Generate A Hex File ..i Have An Embedded C Code But I Want To Generate Hex File I Was Unable To Generate Hex File Using Keil 5 For At89s52

ganesh kolhe ganesh.kolhe21@gmail.com India

Hardware: At89s52 12mhz Freq Software: Embedded C Using Keil 5

when i am trying to generate hex file it will give error

Images

Program


// Programmable School Bell Timer


Sda Define P0.5
Scl = P0.6
Up Define P0.0
Dw Define P0.1
Pg Define P0.2
Sl Define P0.3

Rly Define P1.0
Buz Define P1.1
Goto Main




Prog:
Eve = 1
If Pg = 0 Then Main
If Up = 0 Then Inc_eve
If Dw = 0 Then Dec_eve
If Sl = 0 Then Selec
Seconds = Eve

Gosub Dsp_select


Selec:

Select Case Eve

            Case 1:

                  P2.7 = 0
                  Hou1 = Hours : Min1 = Minutes
                  If Up = 0 Gosub Hup
                  If Dw = 0 Gosub Mup
                  If Pg = 0 Gosub Stor_1
                  If Sl = 0 Gosub Prog
                  Seconds = Eve
                  Gosub Dsp_select

            Case 2:
                                    P2.7 = 0
                  Hou2 = Hours : Min2 = Minutes
                  If Up = 0 , Hup
                  If Dw = 0 , Mup
                  If Pg = 0 , Stor_2
                  If Sl = 0 , Prog
                  Seconds = Eve
                  Gosub Dsp_select

            Case 3:

                  P2.7 = 0
                  Hou3 = Hours : Min3 = Minutes
                  If Up = 0 , Hup
                  If Dw = 0 , Mup
                  If Pg = 0 , Stor_3
                  If Sl = 0 , Prog
                  Seconds = Eve
                  Gosub Dsp_select
                  Loop

            Case 4:
                  Do
                  P2.7 = 0
                  Hou4 = Hours : Min4 = Minutes
                  If Up = 0 , Hup
                  If Dw = 0 , Mup
                  If Pg = 0 , Stor_4
                  If Sl = 0 , Prog
                  Seconds = Eve
                  Gosub Dsp_select
                  Loop

            Case 5:
                  Do
                  P2.7 = 0
                  Hou5 = Hours : Min5 = Minutes
                  If Up = 0 , Hup
                  If Dw = 0 , Mup
                  If Pg = 0 , Stor_5
                  If Sl = 0 , Prog
                  Seconds = Eve
                  Gosub Dsp_select
                  Loop

            Case 6:
                  P2.7 = 0
                  Hou6 = Hours : Min6 = Minutes
                  If Up = 0 , Hup
                  If Dw = 0 , Mup
                  If Pg = 0 , Stor_7
                  If Sl = 0 , Prog
                  Seconds = Eve
                  Gosub Dsp_select


            Case 7:

                  P2.7 = 0
                  Hou7 = Hours : Min7 = Minutes
                  If Up = 0 , Hup
                  If Dw = 0 , Mup
                  If Pg = 0 , Stor_7
                  If Sl = 0 , Prog
                  Seconds = Eve
                  Gosub Dsp_select

            Case 8:
                  P2.7 = 0
                  Hou8 = Hours : Min8 = Minutes
                  If Up = 0 , Hup
                  If Dw = 0 , Mup
                  If Pg = 0 , Stor_8
                  If Sl = 0 , Prog
                  Seconds = Eve
                  Gosub Dsp_select

            End Select
                  Goto Prog




Inc_eve:
Incr Eve
If Eve = 9 Then Eve = 1
Return

Dec_eve:
If Eve <> 1 Then Decr Eve
Return





Main:

On Timer0 Timer_int
Start Timer0


Read_eeprom(min1)
Read_eeprom(hou1)



If Up = 0 Gosub Hup
If Dw = 0 Gosub Mup
If Pg = 0 Gosub Prog

Gosub Dsp_select
Gosub Check
Loop


Check:
If Hours = Hou1 And Minutes = Min1 And Seconds =< 5 Then
Set Rly : Set Buz
Else

If Hours = Hou2 And Minutes = Min2 And Seconds =< 5 Then
Set Rly : Set Buz
Else

If Hours = Hou3 And Minutes = Min3 And Seconds =< 5 Then
Set Rly : Set Buz
Else

If Hours = Hou4 And Minutes = Min4 And Seconds =< 5 Then
Set Rly : Set Buz
Else

If Hours = Hou5 And Minutes = Min5 And Seconds =< 5 Then
Set Rly : Set Buz
Else

If Hours = Hou6 And Minutes = Min6 And Seconds =< 5 Then
Set Rly : Set Buz
Else

If Hours = Hou7 And Minutes = Min7 And Seconds =< 5 Then
Set Rly : Set Buz
Else

If Hours = Hou8 And Minutes = Min8 And Seconds =< 5 Then
Set Rly : Set Buz

Else
Reset Rly : Reset Buz
End If
End If
End If
End If
End If
End If
End If
End If
Return






Dsp_select:

Number = Hours / 10
P3 = %01111111
Gosub Disp

Number = Hours * 10
P3 = %b10111111
Gosub Disp

Number = Minutes / 10
P3 = %11011111
Gosub Disp

Number = Minutes * 10
P3 = %11101111
Gosub Disp

Number = Seconds / 10
P3 = %11110111
Gosub Disp

Number = Seconds * 10
P3 = %11111011
Gosub Disp
Return



Hup:
Hours = Hours + 1
If Hours >= 24 Then
Hours = 0
End If
Return


Mup:
Minutes = Minutes + 1
If Minutes >= 60 Then
Minutes = 0
End If
Return






Disp:
Count = 0 To 9
If X = Number Then
P2 = Segment
End If
Return


Timer_int:
Clock_word = Clock_word + 1
If Clock_word > 120000 Then
Clock_word = 0
Once_a_sec = 1
End If
Return




Stor_1:
      Write_eeprom(min1)
      Write_eeprom(hou1)
      Wait 1
Goto Main

Stor_2:
Gosub Dsp_select
      Write_eeprom(min2)
      Write_eeprom(hou2)
      Wait 1
Goto Main

Stor_3:
Gosub Dsp_select
      Write_eeprom(min3)
      Write_eeprom(hou3)
      Wait 1
Goto Main

Stor_4:
Gosub Dsp_select
      Write_eeprom(min4)
      Write_eeprom(hou4)
      Wait 1
Goto Main

Stor_5:
Gosub Dsp_select
      Write_eeprom(min5)
      Write_eeprom(hou5)
      Wait 1
Goto Main

Stor_6:
Gosub Dsp_select
     Write_eeprom(min6)
     Write_eeprom(hou6)
      Wait 1
Goto Main

Stor_7:
Gosub Dsp_select
      Write_eeprom(min7)
      Write_eeprom(hou7)
      Wait 1
Goto Main

Stor_8:

Gosub Dsp_select
      Write_eeprom(min8)
      Write_eeprom(hou8)
      Wait 1
Goto Main

Replies

R Avinash Gupta
2017-01-19 10:41:54
This program is NOT in C but in BASIC language
R ganesh
2017-01-19 16:17:51
i can't understand how to generate hex file plzz help me

Post a reply to ganesh kolhe

Think you can help ganesh kolhe ? Then post your thoughts that might help ganesh kolhe. You will earn a lot of reputation in the technical community.

If your program is in multiple files, then ZIP the entire folder and attach below

Images and Screenshots

These helps other better understand your suggestion.