Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[Moved] Soft Uart PIC serial communication

Status
Not open for further replies.

Kunal2

Junior Member level 3
Joined
Jun 21, 2011
Messages
27
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,512
Dear all

I am currently trying to simulate a program on PIC simulator IDE (Oshon software). The program compiled without any error in MikroBasic. Leds are flashing at port b.1 at intervals showing information reception but on the soft uart simulation interface, nothing is appearing. However when i tried the program with USART it works both in simulation and real life. I am posting both codes. Can you please help me out?

Kind regards

Kunal

Soft Uart Program

Code:
program soft_uart_1

dim received_byte as byte


main:
TRISB=$01               'defining portb.1 as ouput(TX) and portb.0 as input(RX)
PORTB=0                 'setting portb as output
  Soft_Uart_Init(PORTB, 1, 2, 9600, 0)   ' Initialize soft UART
  received_byte=$80
  
  eloop:

   soft_Uart_Write(received_byte)        ' Send data via UART
   delay_us(3000)
goto eloop
  
end.




program USARTCOMM_part1 'this program will send hex value 88 continuously

Code:
dim result as byte ' defining variable to contain
                   ' adc result to transmit as byte

'main program of transmission
main :

'result = $00
 result = $80
Usart_init(9600)'using NRZ(non return zero) format with 1 start bit, 8 data bits
                'and 1 stop bit
                
TRISC= $C0   'transmitting along bit 7 and receiving along bit 6 of port C

TXSTA = $24 'Bit 7 =0 CSRC (Don't Care)
            'Bit 6 =0 TX9=0
            'Bit 5 =1 TXEN=1
            'Bit 4 =0 SYNC=0
            'Bit 3 =0
            'Bit 2 =1 BRGH=1
            'Bit 1 =0
            'Bit 0 =0

loop:
'result= result+1
Usart_Write(result)

delay_us(500)

goto loop

end.
 
Last edited:

Re: Soft Uart PIC serial communication

I am sorry for not using syntaxes with my codes. Can you please help me solve this problem?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top