When the I / O output switch  input , I have encountered...

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

When the I / O output switch  input , I have encountered...

2,604 Views
xiaolin_gao
Contributor I
When the I / O output switch  input , I have encountered a problem: the switch appear the 2.5V level, how to solve it? Thanks
Labels (1)
0 Kudos
11 Replies

775 Views
xiaolin_gao
Contributor I
hi,kef.
 
   Thank you very much for the help, I will have to crazy:smileysad:
0 Kudos

775 Views
xiaolin_gao
Contributor I
hi,kef
 
void wait_ready(void)
{
     //setReg8(PTBPE, 0x00);
    setReg8(PTBDD, 0x00);
 
 do{
     //clr_ENABLE();
     clr_A0();                     
     set_WR();                    
     set_ENABLE();
     NOP();                          
     }while(lcd_data & status_busy);   //mask it dubug
    clr_ENABLE();
    setReg8(PTBDD, 0xFF);
 }
 
Is that right? thank you!
0 Kudos

775 Views
xiaolin_gao
Contributor I
hi, kef
     When I / O port pins appear 2.5V, I removed the external level, the external level measurement is 5V, and this I / O port pin level is 0V, and why?
 
 
When PTBSC=0x00, then level from 2.5v to about 0.8v, why?
 
  thank you !
0 Kudos

775 Views
xiaolin_gao
Contributor I
hi.peg, I use mc9s08 to drive 122*32 LCD,The following program
 

#define A0 PTAD_PTAD0   /*_command or data*/     
#define CS1 PTAD_PTAD1     
#define CS2 PTAD_PTAD2     
#define _WR PTAD_PTAD3     
#define lcd_data PTBD                 
#define ENABLE PTCD_PTCD0

#define set_CS1() (CS1=1)         
#define set_CS2() (CS2=1)         
#define set_A0() (A0=1)        
#define set_WR() (_WR=1)       
#define set_ENABLE() (ENABLE=1)
 
#define clr_CS1() (CS1=0)         
#define clr_CS2() (CS2=0)        
#define clr_A0() (A0=0)         
#define clr_WR() (_WR=0)        
#define clr_ENABLE() (ENABLE=0)
 
 
 
void wait_ready(void)
{
     //setReg8(PTBPE, 0x00); 
    setReg8(PTBDD, 0x00);
 
 do{
     clr_ENABLE();
     clr_A0();                      
     set_WR();                     
     NOP();                           
     }while(lcd_data & status_busy);   //mask it dubug
   setReg8(PTBDD, 0xFF);
 }
 
i use  68-type microcontroller connect to LCD,thank you!
 
0 Kudos

775 Views
kef
Specialist I
I guess you are driving two SED1520 LCD controllers or something like that?
Still it's not clear what you meant in your first message. But if you say you are using  68-type bus mode, then I don't see where you are pulsing E signals (CS1 and CS2 probably). If you select LCD controllers outside the wait_ready routine, then you should not set bus direction to output  setReg8(PTBDD, 0xFF);  before E signal is set back to 0.
0 Kudos

775 Views
xiaolin_gao
Contributor I
Sorry! Wrong.it should be changed to
   
 
 
When PTBDS=0x00, then level from 2.5v to about 0.8v, why?
 
  thank you !
0 Kudos

775 Views
kef
Specialist I
I guess it's because LCD controller drives the data bus. In 68 mode, to read from LCD you should:
 
1) make sure MCU data bus port direction (portB?) is set to input
2) set up address pins (A0)
3) set R/W pin to 1
4) set E pin (you call it CS probably) of one of LCD controllers (not both at the same time) to one
5) perform read from data bus port
6) set E pin(s) back to 0
 
I see steps 4 and 6 are missing in your code
0 Kudos

775 Views
xiaolin_gao
Contributor I
freescale engineers Where ah? Please help , thank you!
0 Kudos

775 Views
peg
Senior Contributor IV
Hi xiaolin,

I imagine most people are on holiday at the moment.
Also, if you provide some more details people may be more willing to help you.
The waveform looks quite strange, but is switching to the different levels quite positively.

1. In your question you mention input and output but don't say whether you are talking about something driving a MCU input or an MCU output driving something.

2. In either case, tell us what "something" is. (i.e. what is connected to the i/o you are measuring?)

3. Have you disconnected the i/o to be sure the distortion is being caused by the MPU side and not the thing that is connected?

Please answer the above questions and we may be able to start to get somewhere.


0 Kudos

775 Views
xiaolin_gao
Contributor I
Hello!  could you point you in detail? close pull up  still  the same situation:smileysad:
0 Kudos

775 Views
JulsPower
Contributor II
do you have a pull up to 3.3V?
0 Kudos