Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 01, 2024, 12:57:44 00:57


Login with username, password and session length


Pages: [1]
Print
Author Topic: Full duplex software uart  (Read 8313 times)
0 Members and 1 Guest are viewing this topic.
Ichan
Hero Member
*****
Offline Offline

Posts: 833

Thank You
-Given: 312
-Receive: 392



WWW
« on: December 05, 2011, 09:24:10 21:24 »

Hi,

Here is my work of it, software uart for 16 bit pic family - full duplex interrupt driven ring buffered for both tx and rx.

It use change notification interrupt for start bit detection, perhaps using external interrupt will be better but i just want to experiment with it. TX and RX handled by two timer interrupt, in this case Timer4 for RX and Timer5 for TX.

On a test using proteus simulation with another two interrupt driven hardware uart it can go up to 19200 bps without missing any 10ms event on the main loop.

Attached the complete MPLAB C30 project and Proteus files, remember up to now it has not yet tried on the real hardware.

EDIT: Tools used are MPLAB IDE v8.80 + MPLAB C30 v3.30c + Proteus 7.8

-ichan

« Last Edit: December 07, 2011, 04:41:48 16:41 by Ichan » Logged

There is Gray, not only Black or White.
Ichan
Hero Member
*****
Offline Offline

Posts: 833

Thank You
-Given: 312
-Receive: 392



WWW
« Reply #1 on: December 06, 2011, 09:00:18 21:00 »

It should be more interesting if it can work on low end pic, so here it is - full duplex software uart for 8 bit pic family.

Tested with proteus on pic12f615 (1 kword flash, 64 byte ram, no hw uart), it use about 25% flash and 50% ram (mainly for buffer). The requirement is 1 external interrupt and 2 timer, so it can not be used on pic10f family except if only RX or TX is needed, not both.

Attached the MPLAB + HT-PICC project and Proteus files, 9600bps full duplex at 8Mhz internal osc - sounds good enough?

EDIT: Tools used are MPLAB IDE v8.80 + HI-TECH PICC v9.83 in pro mode + Proteus 7.8


-ichan
« Last Edit: December 07, 2011, 04:44:02 16:44 by Ichan » Logged

There is Gray, not only Black or White.
iphone
Active Member
***
Offline Offline

Posts: 168

Thank You
-Given: 115
-Receive: 10


« Reply #2 on: December 07, 2011, 03:06:51 15:06 »

Hi Ichan,

I cannot compile the 8 bit version of your software UART. I use MPLAB v8.56.

below the error msg.
Logged
Ichan
Hero Member
*****
Offline Offline

Posts: 833

Thank You
-Given: 312
-Receive: 392



WWW
« Reply #3 on: December 07, 2011, 04:14:01 16:14 »

Hi Iphone,

The problem is on the HT-PICC compiler, I use a just installed ver 9.83 - some differences on register names on headers, discussed in here:

http://www.sonsivri.to/forum/index.php?topic=935.msg122874#msg122874

You can install the newer version of HT-PICC, or just change some name used on the code:

T1Ix -> TMR1Ix
GPIOx -> GPx
OTION_REG -> OPTION

-ichan

Logged

There is Gray, not only Black or White.
iphone
Active Member
***
Offline Offline

Posts: 168

Thank You
-Given: 115
-Receive: 10


« Reply #4 on: December 07, 2011, 04:20:24 16:20 »

Hi Ichan,

What version of MPLAB you use ?

Thanks for the info.
« Last Edit: December 07, 2011, 04:45:47 16:45 by iphone » Logged
metal
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2420

Thank You
-Given: 862
-Receive: 678


Top Topic Starter


« Reply #5 on: December 07, 2011, 06:31:36 18:31 »

it has nothing to do with MPLAB. Ichan says it is the new compiler version that differs due to new register naming convention. Open the corresponding header file for your device and change your code according to the new ones, that's it. It is a real silly thing asking the same question two times.
Logged
iphone
Active Member
***
Offline Offline

Posts: 168

Thank You
-Given: 115
-Receive: 10


« Reply #6 on: December 09, 2011, 03:10:39 03:10 »

it has nothing to do with MPLAB. Ichan says it is the new compiler version that differs due to new register naming convention. Open the corresponding header file for your device and change your code according to the new ones, that's it. It is a real silly thing asking the same question two times.

I'm very sorry n tq.
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC