Hi, i need help with the sci, i can send and receive, but i can´t move the data received to the port B.
I try turn off the sci and then move to the port B and it works, but if not the port B show 09h (hexadecimal) (PTB1 = 1 ; PTB3 = 1).
Too i send a character when receipt and i receive 2 characters.
The connection is between the PC and uC, and use the Termite 2.6 for read the characters that sends the uC
I´m using the MC908JL8CPE , sorry for my english, and thanks for everything
Here attached my code:
init: mov #$01,config1 ;Disable WatchDog mov #$00,config2 mov #$FF,DDRB mov #$40,DDRD clr PORTB clr PORTD mov #$03,VAR clra init_SCI: ;***** SCBR: SCP1=0,SCP0=0,SCR2=0,SCR1=1,SCR0=0 ******* mov #$02,SCBR ;Baud Rate register = 9600 ;***** SCC1: LOOPS=0,ENSCI=1,TXINV=0,M=0,WAKE=0,ILTY=0,PEN=0,PTY=0 ******* mov #$40,SCC1 ;Control register 1 ;***** SCC2: SCTIE=0,TCIE=0,SCRIE=0,ILIE=0,TE=1,RE=1,RWU=0,SBK=0 ******* mov #$0C,SCC2 ;Control register 2 (TE,RE enable) ;***** SCC3: R8=0,T8=0,ORIE=0,NEIE=0,FEIE=0,PEIE=0 ******* mov #$00,SCC3 ;Control register 3 recepcion: lda SCS1 brclr SCRF,SCS1,* mov SCDR,VAR mov VAR,PORTB lda SCS1 mov 'R',SCDR brclr SCTE,SCS1,* jmp recepcion
Hi, how are you getting on with this problem? I tried your code in Codewarrior, making minimal changes to get it to assemble (eg to the names of registers) and then tried it in the simulator program. The only thing that really seems wrong is that the 'R' should be #'R'. Apart from that it seems to work fine, so maybe the problem is with the terminal program sending something unexpected as you seem to suspect.
I'm a big fan of the simulator, it is great for seeing exactly what is going on and can even give clues about some aspects that may not be clear in the datasheet for a mcu. Another thing that might be useful to look at with Codewarrior is the processor initialisation feature, which is very helpful. One of the things it would do differently is that it would not enable things (eg SCI) until after it had finished configuring them, although this doesn't seem to matter in your case.
Good luck with the terminal side of things!