Creating simple TCNT0 program ATMEGA 328 P-PU - atmega

I have a trouble with my beginner program for Arduino + ATMEGA 328 P-PU with tcnt0 in CTC mode, where I am using overflow made by OCR0A to make some visible delay. It looks, that counter is working somehow, because OC0A lit, however delay made with TOV0 or OCF0A doesnot work, because of "strange lit of apropriate diode". Could you help me to find mistake(s) in my program? Thanks all for help!
Btw: Do you know some good and verified debuger under Linux?
Program with mistakes:
; TCCR0 registers addresses
.equ tccr0a, 0x44
.equ tccr0b, 0x45
.equ tcnt0, 0x46
.equ ocr0a, 0x47
.equ ocr0b, 0x48
.equ tifr0, 0x35
.equ timsk0, 0x6E
.equ io_tccr0a, 0x24
.equ io_tccr0b, 0x25
.equ io_tcnt0, 0x26
.equ io_ocr0a, 0x27
.equ io_ocr0b, 0x28
.equ io_tifr0, 0x15
; PORT registers addresses
.equ pinb, 0x23
.equ io_pinb, 0x3
.equ ddrb, 0x24
.equ io_ddrb, 0x4
.equ portb, 0x25
.equ io_portb, 0x5
.equ pinc, 0x26
.equ io_pinc, 0x6
.equ ddrc, 0x27
.equ io_ddrc, 0x7
.equ portc, 0x28
.equ io_portc, 0x8
.equ pind, 0x29
.equ io_pind, 0x9
.equ ddrd, 0x2A
.equ io_ddrd, 0xA
.equ portd, 0x2B
.equ io_portd, 0xB
; SREG and STACK registers addresses
.equ sreg, 0x5F
.equ io_sreg, 0x3F
.equ sph, 0x5E
.equ io_sph, 0x3E
.equ spl, 0x5D
.equ io_spl, 0x3D
; Constants
.equ RAMEND, 0x8FF ; End of SRAM for ATMEGA328P
.equ MILIS_VALUE, 0x7C ; EDIT: FUCK THE TIME, TCNT0 HAS NO 128 PRESCALER, PRESCALER WILL BE 1024 JUST BECAUSE I WANT PREVIOUS COMMENT HAS NO MEANING NOW ---> ; Time in milisecond counted for 16MHz with 128 prescaler
.org 0 ; RESTART interupt vector
rjmp INITIALIZATION ; Go to the start of the program
.org 0x1C ; TOV0 interupt vector
rjmp DELAY ; Create visible delay from counter interval
.org 0x34 ; Start the program right behind interupt vector table
INITIALIZATION:
ldi r16, hi8(RAMEND) ; High 8 bit value for SPH
out io_sph, r16 ; Store SPH value to SRAM
ldi r16, lo8(RAMEND) ; Low 8 bit value for SPL
out io_spl, r16 ; Store SPL value to SRAM
clr r16 ; R16 = 0
out io_sreg, r16 ; SREG = 0
ldi r16, 0xF0 ; Only high nibble is set
out io_ddrc, r16 ; High nibble in PORTB is set as output because of possibility to check possible error with ease
ldi r16, 0xF0 ; Byte for Output
out io_ddrd, r16 ; Pin OC0A and other pins (PORTD.7-4 included) is set as output
rcall TOOGLE_LED ; Inicialization LED and delay register(s) to the start condition
TCNT_INIT: ; TCNT0 Initialization - not used label
clr r16 ; Prepare value for counter stop, no FOC, third mode bit WGM2 is 0
out io_tccr0b, r16 ; Stop counter
out io_tcnt0, r16 ; Counting register = 0
ldi r16, 0x42 ; Set OC0A to toogle and CTC mode for TCNT0
out io_tccr0a, r16 ; Set control register a for timer 0
ldi r16, 0x1 ; Interupt on TOV0
sts timsk0, r16 ; Enable overflow interupt
ldi r16, MILIS_VALUE ; Count number for 125 count cycles
out io_ocr0a, r16 ; Set top value for counter 0
sei ; Enable ingerupts globaly
out io_tccr0b, 0x05 ; Set divisor to 1024, counter is running now!
MAIN_LOOP:
rjmp MAIN_LOOP ; Infinite loop because of getting interupt from TCNT0
DELAY: ; TOV0 interupt subroutine
in r20, io_sreg
clr r21
out io_sreg, R21
inc r18
cpi r18, 100
brlt END_DELAY
out io_sreg, R21
clr r18
inc r17
cpi r17, 100
brlt END_DELAY
out io_sreg, R21
clr r17
inc r19
cpi r19, 1
brlt END_DELAY
rcall TOOGLE_LED
out io_sreg, r20
END_DELAY:
reti
TOOGLE_LED:
ldi r17, 0x8 ; The highest bit of the lowest nibble is set for xor mask
in r16, io_portc ; Get actual value of port B
eor r16, r17 ; Toogle the highest pin of port B
out io_portc, r16 ; write changed value to the port B
clr r17 ; R17 = 0 <--- register is used for delay so it must be reseted
clr r18 ; R18 = 0 <--- register is used for delay so it must be reseted
clr r19 ; R19 = 0 <--- register is used for delay so it must be reseted
ret

I will be senior programmer, before someone will answer here with help. ;-)
There are several mistakes in the code.
1) I shouldnot use TOV0 interupt, but I have to set OCIE0A in TCNT_INIT section, therefore use apropriate interrupt vector (what I partialy did in wrong code, because I have tested both, as you can see from old comment).
2) At the end of TCNT_INIT sequence I tried to run counter in CTC mode. It is absolutely wrong, because I put value into place, where address of register should be. Because 0x5 is value for register, it was sucesfuly compiled.
3) The most mean mistake - The interrupt vectors. I copied them directly from datasheet, so I thought, that they are absolutely correct. However after some looking for code examples, I saw very different numbers as interrupt vectors. Trouble was, that in datasheet is information that shows interrupts vectors, BUT EACH ADDRESS IN FLASH POINTS TO TWO BYTES, SO ADDRESS FOR VECTOR FROM DATASHEET MUST BE MULTIPLIED BY TWO FOR ASSEMBLER.
Code that should be working is enclosed below. Mistakes should be fixed. In addition there few lines, that could be erased, because they were used for testing.
Have a nice day.
; TCCR0 registers addresses
.equ tccr0a, 0x44
.equ tccr0b, 0x45
.equ tcnt0, 0x46
.equ ocr0a, 0x47
.equ ocr0b, 0x48
.equ tifr0, 0x35
.equ timsk0, 0x6E
.equ io_tccr0a, 0x24
.equ io_tccr0b, 0x25
.equ io_tcnt0, 0x26
.equ io_ocr0a, 0x27
.equ io_ocr0b, 0x28
.equ io_tifr0, 0x15
; PORT registers addresses
.equ pinb, 0x23
.equ io_pinb, 0x3
.equ ddrb, 0x24
.equ io_ddrb, 0x4
.equ portb, 0x25
.equ io_portb, 0x5
.equ pinc, 0x26
.equ io_pinc, 0x6
.equ ddrc, 0x27
.equ io_ddrc, 0x7
.equ portc, 0x28
.equ io_portc, 0x8
.equ pind, 0x29
.equ io_pind, 0x9
.equ ddrd, 0x2A
.equ io_ddrd, 0xA
.equ portd, 0x2B
.equ io_portd, 0xB
; SREG and STACK registers addresses
.equ sreg, 0x5F
.equ io_sreg, 0x3F
.equ sph, 0x5E
.equ io_sph, 0x3E
.equ spl, 0x5D
.equ io_spl, 0x3D
.equ mcucr, 0x55
.equ io_mcucr, 0x35
; Constants
.equ RAMEND, 0x8FF ; End of SRAM for ATMEGA328P
.equ MILIS_VALUE, 0x7C ; EDIT: FUCK THE TIME, TCNT0 HAS NO 128 PRESCALER, PRESCALER WILL BE 1024 JUST BECAUSE I WANT PREVIOUS COMMENT HAS NO MEANING NOW ---> ; Time in milisecond counted for 16MHz with 128 prescaler
.org 0 ; RESTART interupt vector
jmp INITIALIZATION ; Go to the start of the program
.org 0x38 ; OCF0A interupt vector <--- IT LOOKS, THAT ADDRESSES FROM DATASHEET MUST BE DOUBLED BECAUSE OF CALL INSTRUCTION! SEE /usr/lib/avr/include/avr/iom328p.h ,io.h AND OTHER INCLUDE FILES! THIS INFORMATION MUST BE VERIFIED!
jmp DELAY ; Create visible delay from counter interval
.org 0x68 ; Start the program right behind interupt vector table
INITIALIZATION:
ldi r16, hi8(RAMEND) ; High 8 bit value for SPH
out io_sph, r16 ; Store SPH value to SRAM
ldi r16, lo8(RAMEND) ; Low 8 bit value for SPL
out io_spl, r16 ; Store SPL value to SRAM
clr r16 ; R16 = 0
out io_sreg, r16 ; SREG = 0
out io_mcucr, r16 ; MCUCR = 0
ldi r16, 0xFF ; Only high nibble is set
out io_ddrc, r16 ; High nibble in PORTB is set as output because of possibility to check possible error with ease
ldi r16, 0xF0 ; Byte for Output
out io_ddrd, r16 ; Pin OC0A and other pins (PORTD.7-4 included) is set as output
rcall DELAY_INIT ; Inicialization of DELAY subroutine
TCNT_INIT: ; TCNT0 Initialization - not used label
clr r16 ; Prepare value for counter stop, no FOC, third mode bit WGM2 is 0
out io_tccr0b, r16 ; Stop counter
out io_tcnt0, r16 ; Counting register = 0
ldi r16, 0x42 ; Set OC0A to toogle and CTC mode for TCNT0
out io_tccr0a, r16 ; Set control register a for timer 0
ldi r16, 0x2 ; Interupt on OCIE0A
sts timsk0, r16 ; Enable overflow created by OCR0A interupt
ldi r16, MILIS_VALUE ; Count number for 125 count cycles
out io_ocr0a, r16 ; Set top value for counter 0
sei ; Enable global interupts
ldi r16, 0x05
out io_tccr0b, r16 ; Set divisor to 1024, counter is running now! <<<-------THERE WAS ANOTHER MISTAKE!!!!
; in r16, io_sreg ; TEST ONLY !!!! SREG test, control of enabling interupts
; out io_portd, r16 ; TEST ONLY !!!! SREG test, control of enabling interupts
; sbi io_portc, 0 ; TEST ONLY !!!! Test of signal that DELAY subroutine was activated.
MAIN_LOOP:
rjmp MAIN_LOOP ; Infinite loop because of getting interupt from TCNT0
DELAY: ; TOV0 interupt subroutine
in r20, io_sreg
sbi io_portc, 0 ; Tell me, that this interupt was working one times at minimum!
clr r21
out io_sreg, R21
inc r18
cpi r18, 100
brlt END_DELAY
out io_sreg, R21
clr r18
inc r17
cpi r17, 1
brlt END_DELAY
out io_sreg, R21
clr r17
inc r19
cpi r19, 1
brlt END_DELAY
rcall TOOGLE_LED
out io_sreg, r20
END_DELAY:
reti
TOOGLE_LED:
ldi r17, 0x8 ; The highest bit of the lowest nibble is set for xor mask
in r16, io_portc ; Get actual value of port B
eor r16, r17 ; Toogle the highest pin of port B
out io_portc, r16 ; write changed value to the port B
DELAY_INIT:
clr r17 ; R17 = 0 <--- register is used for delay so it must be reseted
clr r18 ; R18 = 0 <--- register is used for delay so it must be reseted
clr r19 ; R19 = 0 <--- register is used for delay so it must be reseted
ret

Related

Volume of cone not returning correct value

My code assembles correctly, however it is not returning the volume of a cone. I tried a few other ways to get it to give me the volume of a cone, and it doesn't give me the correct answer. Is there something I am missing?
Edit: I fixed my code to output a number, however its not giving me the right number.
This is the formula I am using for this code:
V= (22)(r)(r)(h)/21
diviser DWORD 21
height WORD 0
radius BYTE 0 ;*** Declare an unsigned, integer variable for the value
product WORD 0
askRadius BYTE "What is the radius?", 0ah, 0dh, 0 ;*** Declare the prompt and message parts
askHeight BYTE "What is the height? ", 0
volumeOutput BYTE "The volume of the cone is: ", 0
lineBreak BYTE " ",0dh, 0ah, 0
.code
main PROC
mov ebx, diviser ;Initializes the diviser
mov edx,OFFSET askRadius ;Asks for Radius
call WriteString
call ReadDec
mov radius, al ;moves radius into al (8-bit)
mul radius ;Multiplies radius * radius(16-bit)
mov edx,OFFSET askHeight ;asks for Height
call writestring
call ReadDec
mov height, dx ;moves height into AX
mov WORD PTR product, ax ;convert 16-bit into 32-bit
mov WORD PTR product+2, dx ;converts 16-bit into 32-bit
mul eax ;multiplies by 22
mov edx, 22
mul edx
div ebx ;divides by 21
mov edx, OFFSET volumeOutput
call WriteString
call WriteDec
call WaitMsg
exit
main ENDP
END main
Something like this should work better. Note you should choose where you want to widen the calculation to 64 bit.
askRadius BYTE "What is the radius?", 0ah, 0dh, 0 ;*** Declare the prompt and message parts
askHeight BYTE "What is the height? ", 0
volumeOutput BYTE "The volume of the cone is: ", 0
lineBreak BYTE " ",0dh, 0ah, 0
.code
main PROC
mov edx,OFFSET askRadius ;Asks for Radius
call WriteString
call ReadDec
imul eax, eax ; radius * radius
mov ecx, eax ; save for later
mov edx,OFFSET askHeight ;asks for Height
call writestring
call ReadDec
imul eax, eax, 22
mul ecx ;multiplies by radius * radius
mov ecx, 21
div ecx ;divides by 21
mov edx, OFFSET volumeOutput
call WriteString
call WriteDec
call WaitMsg
exit
main ENDP
END main

How to use a button which is port c pin 0 in assembly?

I tried to write some code but i'm beginner at assembly i could not complete i want to blink 2 leds when button pressed. I can blink the leds without button but i could not do with button.
# STM32F107 - Assembly template
.thumb
.syntax unified
# Keep the STACKINIT variable.
.equ STACKINIT, 0x20008000
.equ DELAY, 80000
.equ RCC_APB2ENR, 0x40021018 #
.equ GPIOD_CRL, 0x40011400 # D portuna clock
.equ GPIOD_ODR, 0x4001140C # D portunu output olarak belirledik 0x0C offset
.equ GPIOC_CRL, 0x40011000 # C portuna clock
.equ GPIOC_IDR, 0x40011008 # C portunu input olarak belirledik 0x08 offset
.section .text
.word STACKINIT
.word _start + 1
######################################################################################
# Main code starts from here
######################################################################################
_start:
LDR R6, = RCC_APB2ENR # Load peripheral clock enable regiser
LDR R5, [R6] # Read its content
ORR R5, 0x00000020 # Buranın nasıl bulunacağını biliyorum portlara göre - Bit( A 2 B 3 C 4 D 5 ...)
STR R5, [R6] # Store back the result in Perihperal clock enable register
# Make GIOOD Pin1 as output pin (Page 170 from RM0008)
LDR R6, = GPIOD_CRL # Load GPIOD control register low (Pin1 is in CRL register)
LDR R5, = 0x22222222 # hepsi output yap
STR R5, [R6] # Store back the result in GPIOD control register low
# Enable GPIOC Peripheral Clock (
LDR R6, = RCC_APB2ENR
LDR R5, [R6]
ORR R5, 0x00000010 # c portu
STR R5, [R6]
# Make GIOOC Pins as input pin
LDR R6, = GPIOC_CRL
LDR R5, = 0x11111111 # hepsi input mu oldu butonların bilmiyorum ?
STR R5, [R6]
dongu:
LDR R6, = GPIOC_IDR
LDR R5, = 0x00000001
STR R5, [R6]
BTFSC GPIOC,1
GOTO dongu
# Set GIOOD Pin1 to 1 (Page 172 from RM0008)
LDR R6, = GPIOD_ODR # Load GPIOD output data register
LDR R5, = 0x00000001 # 1. lede elaktirik ver :)
STR R5, [R6] # Store back the result in GPIOD output data register
LDR R1, = 1460000
loop:
SUBS R1 , 1
BNE loop
LDR R6, = GPIOD_ODR # Load GPIOD output data register
LDR R5, = 0x00000002 # 2. LED
STR R5, [R6]
LDR R1, = 1460000
loop1:
SUBS R1 , 1
BNE loop1
B dongu
two problems, I think you are configuring port C as an output not an input. mode should be 00 not 01. and a typo the assembler should of caught, dont you want 0x40011008 not 0x4001108h as the address to port c IDR? the port should reset as an input so long as you dont mess with that or so long as port c pin 0 is not an exception to that rule (I dont see an exception in the register description it defaults to 0x44444444 which is all ports as digital inputs) you can just poll IDR after enabling port C in the RCC.

How do I set up the speaker on a HCS12 microcontroller?

Basically, my microcontroller is supposed to play a sound based on the push buttons (PTH) I press and light up the LED (PORTB). What I am stuck on is how to set up the speaker to output sound when the push buttons are pressed. A lot of the code is based off code from here: http://www.microdigitaled.com/HCS12/Hardware/Dragon12-Plus-Support.htm
Specifically the link about the buzzer. Also when I use the code provided I am able to hear sound coming from my microcontroller; however not when I try to include the push button into the code.
I would greatly appreciate any hints, comments, tips, or suggestions. Thank you so much!
Here is my code so far:
;----------------------USE $1000-$2FFF for Scratch Pad
R1 EQU $1001
R2 EQU $1002
R3 EQU $1003
R4 EQU $1004
;code section
ORG $2000 ;Flash ROM address for Dragon12+
Entry:
LDS #$2000 ;Stack
BSET DDRT,%00100000 ;PTT5 as Output pin for buzzer
BSET DDRP,#$0F ; Set Port P pins 0-3 to output
BSET PTP, #$0F ; Disable 7-Segment Display
; LED
BSET DDRB,$FF
BSET DDRJ,$02
BCLR PTJ,$02
; PBs
BCLR DDRH,$0F
BCLR PTH,$FF ;PORTB as Output
;-------Sound the Buzzer at PTT5
BACK
;-------Get data from DIP switches connected to PORTH and send it to LEDs of PORTB
;how is the speaker supposed to be set up? because when I try the code the speaker does not output any sound.
LDAA PTH ;Get data from DIP Switches of PTH
STAA PORTB ;and send it to PORTB
BSET PTT,%00100000 ;PTT5=1
JSR DELAY
BCLR PTT,%00100000 ;PTT5=0
JSR DELAY
BRA BACK ;Keep toggling buzzer
Is my delay okay? Am I on the right track or is there a more convenient way of changing the notes?
;----------DELAY
DELAY
COMA
TSTA
CMPA #$01
BNE no_note1
PSHA ;Save Reg A on Stack
LDAA #7 ;Change this value to hear
STAA R3 ;different Buzzer sounds
;--1 msec delay. The Serial Monitor works at speed of 48MHz with XTAL=8MHz on Dragon12+ board
;Freq. for Instruction Clock Cycle is 24MHz (1/2 of 48Mhz).
;(1/24MHz) x 10 Clk x240x10=1 msec. Overheads are excluded in this calculation.
L3 LDAA #10
STAA R2
L2 LDAA #200
STAA R1
L1 NOP ;1 Intruction Clk Cycle
NOP ;1
NOP ;1
DEC R1 ;4
BNE L1 ;3
DEC R2 ;Total Instr.Clk=10
BNE L2
DEC R3
BNE L3
PULA ;Restore Reg A
no_note1:
CMPA #$02
BNE no_note2
PSHA ;Save Reg A on Stack
LDAA #3 ;Change this value to hear
STAA R3 ;different Buzzer sounds
;--1 msec delay. The Serial Monitor works at speed of 48MHz with XTAL=8MHz on Dragon12+ board
;Freq. for Instruction Clock Cycle is 24MHz (1/2 of 48Mhz).
;(1/24MHz) x 10 Clk x240x10=1 msec. Overheads are excluded in this calculation.
L9 LDAA #10
STAA R2
L8 LDAA #210
STAA R1
L7 NOP ;1 Intruction Clk Cycle
NOP ;1
NOP ;1
DEC R1 ;4
BNE L7 ;3
DEC R2 ;Total Instr.Clk=10
BNE L8
DEC R3
BNE L9
PULA ;Restore Reg A
no_note2:
CMPA #$04
BNE no_note3
PSHA ;Save Reg A on Stack
LDAA #2 ;Change this value to hear
STAA R3 ;different Buzzer sounds
;--1 msec delay. The Serial Monitor works at speed of 48MHz with XTAL=8MHz on Dragon12+ board
;Freq. for Instruction Clock Cycle is 24MHz (1/2 of 48Mhz).
;(1/24MHz) x 10 Clk x240x10=1 msec. Overheads are excluded in this calculation.
L4 LDAA #15
STAA R2
L5 LDAA #240
STAA R1
L6 NOP ;1 Intruction Clk Cycle
NOP ;1
NOP ;1
DEC R1 ;4
BNE L6 ;3
DEC R2 ;Total Instr.Clk=10
BNE L5
DEC R3
BNE L4
PULA ;Restore Reg A
no_note3:
CMPA #$08
BNE no_note4
PSHA ;Save Reg A on Stack
LDAA #9 ;Change this value to hear
STAA R3 ;different Buzzer sounds
;--1 msec delay. The Serial Monitor works at speed of 48MHz with XTAL=8MHz on Dragon12+ board
;Freq. for Instruction Clock Cycle is 24MHz (1/2 of 48Mhz).
;(1/24MHz) x 10 Clk x240x10=1 msec. Overheads are excluded in this calculation.
L30 LDAA #16
STAA R2
L20 LDAA #249
STAA R1
L10 NOP ;1 Intruction Clk Cycle
NOP ;1
NOP ;1
DEC R1 ;4
BNE L10 ;3
DEC R2 ;Total Instr.Clk=10
BNE L20
DEC R3
BNE L30
;--------------
PULA ;Restore Reg A
no_note4:
RTS
;-------------------
;----------------------------------------------------
; Interrupt Vector
;----------------------------------------------------
; Port H Vector
; $3E4C = $FFCC - $C180
ORG $3E4C
FDB DELAY
FINISH:
NOP
END

How to declare a global dword pointer in x86?

I need to declare two global dword pointers that point to two arrays. To my knowledge, global means declare in .data. Is that correct? What is the code to declare these dword pointers so that the are initialized to 0 in x86 assembly with NASM and Intel syntax?
I need to declare two global dword pointers that point to two arrays.
That's simple if i understand correctly, assuming they mean global as in to all files, make a file called pointers.asm or something and type:
[section] .bss
global _pointer1, _pointer2
_pointer1 resd 4 ; reserve 4 dwords
_pointer2 resd 4
We use a .bss section because that memory is set to zero so when you use it your variables are 0 initialized
Or you could just use a .data section if you want and initialize each element to zero yourself:
[section] .data
global _pointer1, _pointer2
_pointer1 dd 0,0,0,0
_pointer2 dd 0,0,0,0
Also still using a .data section, it could be done like this allowing you to specify the size of a buffer like with the .bss section:
[section] .data
global _pointer1, _pointer2
_pointer1 times 4 dd 0
_pointer2 times 4 dd 0
Regardless of the way you decide to do it, to use a pointer to an array declared globally in a separate file:
[section] .text
global _main
extern _pointer1
bytesize equ 4 ; dword = 4 bytes
_main:
; write each element of the array
mov dword [_pointer1 + 0 * bytesize], 0xa
mov dword [_pointer1 + 1 * bytesize], 0xb
mov dword [_pointer1 + 2 * bytesize], 0xc
mov dword [_pointer1 + 3 * bytesize], 0xd
; read each element of the array
mov eax, [_pointer1 + 0 * bytesize]
mov eax, [_pointer1 + 1 * bytesize]
mov eax, [_pointer1 + 2 * bytesize]
mov eax, [_pointer1 + 3 * bytesize]
ret
This main program returns with 0xd or 13 stored in eax, hopefully by looking at this you can get a grasp what is going on.

8051 Serial Port Receive Data Loss

I am making simple messaging program such that I have two 8051 machine one of them is transmitter and the other is receiver. Transmitter sends 8 charachters which is coded as:
...
mov r7, #8
mov r0, #30h
TRS: clr TI
mov sbuf, #r0
inc r0
jnb TI, $
djnz r7, TRS
I get those 8 charachters from keyboard and they are surely on 30h to 37h. After getting those 8 chars I send the data. However the thing that i see in the receivers LCD is the first charachter of 8 byte. ie if i typed 1 2 3 4 5 6 7 8, receiver can get only 1 and displays it. This is the code for receiver:
...
mov r7, #8
REC: jnb RI, $
mov a, sbuf
acall SEND_DATA
clr RI
djnz r7, REC
Receiver waits for another 7 chars. When i type 64 chars from transmitter receiver takes only 8 of them which are mod8=1. I am clearing the RI flag and waiting for the next rising edge for RI which is supposed to be next char coming from trasmitter. What could be the reason?
Regards

Resources