Author Topic: Power-On Port Status Problem  (Read 4088 times)

adam_blue

  • Guest
Power-On Port Status Problem
« on: January 29, 2012, 06:11:05 pm »
Hi,

I’m not good at programming…
I’ve done a basic circuit with AT89C2051. 
It has 2 input button and 10 output (relay).
When button 1 pressed, output relays will sequentiallay work 10 seconds and after stop.
When button 2 pressed, output relays will sequentiallay work 8 seconds and after stop.



My problem is;
At the power-up, microcontroller is doing it’s Port’s “logic-1”
I’ve written program’s first rows;
P1 = 0
P3 = 0   

However, at the power-up for a little time ,  microcontroller is doing it’s Port’s logic-1… !!! ???  (P1 and P3 is FF)

How will  I change microcontroller’s  Reset (PORT) values  ?



BASCOM program is below ;
(Micro-C version has given same result.)

' VARIABLES     
Dim time as byte


' FUNCTIONS
Declare Sub Relay_Cont(time as byte)         


' CONFIGURATIONS                  
$CRYSTAL = 11059200                     

'* Reset all the ports *
   P1 = 0
   P3 = 0   


'loop forever
Do
    if P3.2=1 Then Call Relay_Cont(10)
    if P3.3=1 Then Call Relay_Cont(8)
Loop

End


Sub Relay_Cont(time as byte)                  
      set P3.7
      wait time
      reset P3.7
                  
      set P1.0
      wait time
      reset P1.0
      
      set P1.1
      wait time
      reset P1.1
      
      set P1.2
      wait time
      reset P1.2
      
      set P1.3
      wait time
      reset P1.3
   
      set P1.4
      wait time
      reset P1.4
      
      set P1.5
      wait time
      reset P1.5
      
      set P1.6
      wait time
      reset P1.6
      
      set P1.7
      wait time
      reset P1.7
End Sub