CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

16F877 Uart Question

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Next_G



Joined: 11 Jun 2016
Posts: 4

View user's profile Send private message

16F877 Uart Question
PostPosted: Sat Jun 11, 2016 12:15 pm     Reply with quote

Hi To All

This is my first post. I hope somebody can give me a hand. I am trying to simulate a Phillips uart. This are using wr,rd,cs,int, d0-d7, a0-a3,rx,tx,reset, the other pins are not in use. Reading specs for the 16f877, I can use cs,rd,wr,d0-d7. The general idea is for a parallel to serial converter but i need all pins previously described. d0-d7 is for usage in port d, this data is exported to a application in vb6 in serial mode 9,600,n,8,1. With proper interrupts. It´s possibble the full emulation of duart chip?.

Thanks for any reply about this issue.

Next
temtronic



Joined: 01 Jul 2010
Posts: 9163
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Jun 11, 2016 2:43 pm     Reply with quote

When posting, please give a 'link' to any chips you're using, in this case the 'Philips' UART.
Also do you want FULL emulation? ie: BOTH serial to parallel AND parallel to serial, or just one of them? Also what kind of speed is required (baudrate)?

It's 'all in the details' but yes it is possible to do !! BTDT

Jay
Next_G



Joined: 11 Jun 2016
Posts: 4

View user's profile Send private message

Uart Phillips
PostPosted: Sat Jun 11, 2016 6:43 pm     Reply with quote

Temtronic

Thank you for responding and I apologize if I miss information. The UART in question is the NXP sc26c92. The required emulation is only parallel to serial, the rest done by wr, rd, a0-a3, rx, tx. The transmission speed is 9600, n, 8, 1. If I still am not clear again I offer apologies and will give you even more information.

Thanks, again.
Next
Ttelmah



Joined: 11 Mar 2010
Posts: 19338

View user's profile Send private message

PostPosted: Sun Jun 12, 2016 12:44 am     Reply with quote

I'd say no.

Unfortunately, a lot depends on the code that is driving the Phillips chip.
Problem is that if the code controlling the UART, actually strobes the WRN and RDN lines at anything even remotely close to the 'allowed' minimum, your PIC will miss them. These are allowed to be just 70nSec wide. latching the data at this sort of speed, requires _hardware_.

There are PIC's that have external PSP ports, which with a bit of external logic, might be able to latch the data successfully.

Then the chip you are referring to, is a dual UART. At the very least you need a PIC with dual hardware UART's. A software UART is not suitable for receiving 'unsolicited' data, while the chip is doing other things, which the PIC is going to have to do.

So at the very least you would need a PIC with a PSP port and dual UART's.
There would need to be a little external logic to create the correct patterns to control the PSP from the UART signals. Then it might just about be doable.
The only PIC's with this sort of hardware, are all PIC18's, and much larger packages. For chips supporting 5v operation, devices like the 18F8527, or the 18F65K22, which are in 64pin or larger packages.

You could do it with almost any dual UART PIC, by having external latches. So using a FPGA to latch the data, or quite a number of discrete chips.
temtronic



Joined: 01 Jul 2010
Posts: 9163
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Jun 12, 2016 4:32 am     Reply with quote

I read his request as only needing one 'parallel to serial' section of the Philips UART and since the 'external' device was controllig the rd/wr/data lines using the PSP of the PIC for input is easy and converting to serial at 9600 even easier. You could even just use regular I/O pins as speed isn't 'fast' (9600 baud is 'slow' these days!)
Like I said, it's all in the details, and knowing 'what' is the input device is critical. As long as there is some type of 'new incoming data ready' flag it's
not that hard.

Jay
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Sun Jun 12, 2016 7:59 am     Reply with quote

Two words jump out :
that fresh from the Proteus ISIS works store room- "16f877" and
my all time hardware favorite :
"simulation" ....... Very Happy Very Happy
Ttelmah



Joined: 11 Mar 2010
Posts: 19338

View user's profile Send private message

PostPosted: Sun Jun 12, 2016 9:11 am     Reply with quote

The big problem is just how fast the lines may be strobed. Point is that he is talking about the chip being used with Windows (refers to VB). This will then use the Windows driver, which will strobe the lines really fast. The actual data rate is not the problem, but I bet the Windows driver for the chip doesn't take any longer than it has to, between outputting the byte, and strobing it, and the strobe itself will probably only be a uSec at most.

If he does only want a single channel, then a chip with a single UART and PSP could be made to do it, but there would need to be a little external hardware, since the PSP needs a R/W line for bi-directional, and the chip uses separate read and write strobes.
Next_G



Joined: 11 Jun 2016
Posts: 4

View user's profile Send private message

Uart Question
PostPosted: Sun Jun 12, 2016 10:13 am     Reply with quote

Hi To All

Thanks for all replies. It's true that this uart use wr, rd in separate ways. The uart scc68692 for example have only a single pin for both operations. However i need in separate ways. The write and read operations depends agree with datasheet, of the status in cs and int pins. About the speed really it' not a big trouble at least for now. About vb this is the way I test, for example if i receive from D0-D7 in hex format (25,43,67,72,24,36,54,34), if i receive 72, i need to reply 72 21. I'm using realterm for terminal purposes. The speed for testing is 200ms, obviously under the vb simulation the things colud be seen easily. To build in pic it's more complicated, the bits are present and i can see because is only under reading mode. However if i try to write probably i can't do because you need an interruption to write 72 21 and wait for a new reply. Again thanks, i think that better way to do this is get the original uart or a nearest possible replacement.

Next
temtronic



Joined: 01 Jul 2010
Posts: 9163
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Jun 12, 2016 10:22 am     Reply with quote

OK, now I'm confused( yeah, 'Old Man Syndrome') ...
he said..
The required emulation is only parallel to serial

so I assumed he has a 'device' that HAS parallel data that has to be converted into serial( say to be read by the PC using VB ).

I really need a picture or drawing or napkin artwork to truly understand what IS required.

Jay
dyeatman



Joined: 06 Sep 2003
Posts: 1923
Location: Norman, OK

View user's profile Send private message

PostPosted: Sun Jun 12, 2016 11:13 am     Reply with quote

Not to mention all that work for a $5.60 chip...minus the cost of the PIC chip.
_________________
Google and Forum Search are some of your best tools!!!!
Next_G



Joined: 11 Jun 2016
Posts: 4

View user's profile Send private message

Uart Question
PostPosted: Sun Jun 12, 2016 12:06 pm     Reply with quote

Totally, Agree

However two things first, is a simple 5.60 chip easy to get probably in another countries, but not in mine, second the constant learning don`t have limits, and sometimes we want to be more creatives still when the solutions are around the corner, but for this reason write here and i`am happy whit all the feedback, again thanks to all for support, i`am sure that i can find the way.

Best Regards

Next
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group