UART setup for 801C188EB/80186

I'm guessing this is test code to get the durn thing to work without resetting. I get that. But he needs to show his code.

--

Rick
Reply to
rickman
Loading thread data ...

After following the discussion, it appears that the original code has never existed. :-)

Reply to
upsidedown

I had to dig up some backups from a quarter century ago ...

Here is a test that has been run in 1990, compiled with Borland C:

---- clip clip ----

/* TEST.C - Serial output test */

/* Compiler controls for Borland C++ v. 2 */

#pragma option -ms /* small addressing */ #pragma option -1 /* 80186 family processor */ #pragma option -a- /* pack structures tightly */ #pragma option -b- /* short enums */ #pragma option -d /* do not duplicate strings */ #pragma option -f- /* no floating point */

#ifdef _DEBUG #pragma option -v /* add symbols to code */ #else #pragma option -G /* optimize code speed */ #pragma option -O /* optimize code */ #pragma option -Z /* optimize pointers */ #pragma option -k- /* no need for normal stack frame */ #endif

#define CPUCLK 16000000L /* CPU clock: 16 MHz */

/* 80186EB hardware registers */

#define CPUIO 0xff00 /* CPU I/O address base */ #define B0CMP (CPUIO + 0x60) /* serial 0 baud compare */ #define S0CON (CPUIO + 0x64) /* serial 0 control */ #define S0STS (CPUIO + 0x66) /* serial 0 status */ #define S0TBUF (CPUIO + 0x6a) /* serial 0 transmit buffer */

#define ICLK (1

Reply to
Tauno Voipio

the

Thanks a lot for your input Tauno Voipio. Im sure this would help identify whats going wrong with my method. really appreciate you searching for it, as I have never worked with this processor before, this is a very good pointer and a start

--------------------------------------- Posted through

formatting link

Reply to
srao

show

code.

stuck.

Hi Rick,

I will post the complete code soon. As far as i read the data sheet, the watchdog (hardware) is connected to one of the ooutput pins and I am just trying to continously write 0 or 1 to this port to not allow it to kick the watchdog timer and reset the pin. I did not find a mention of a specific sequence to be set to stop the watchdog from kicking. Will post source code soon.

--------------------------------------- Posted through

formatting link

Reply to
srao

code.

The exact source code is as below. This lies within main()

while(1) {

for (i=0;i

Reply to
srao

I'm having difficulty trying to figure out what you are trying to do, but I can tell you that no matter what you /think/ you are doing, your code is /badly/ wrong. It is wrong in a way that indicates you have no idea what you are doing. (This is constructive criticism aimed at helping you where you need it most - I am not trying to be insulting.)

It is time to take a step back, and look at the big picture here. What are you trying to achieve, and why are you doing it?

If you are trying to learn about embedded programming, you are going about it the wrong way - pick a modern, friendly microcontroller and a decent book (ask here for advice if you like).

If you are doing this professionally, then it can only be in the context of maintaining an ancient system. Without a larger context, it is impossible to judge whether something this old /should/ be maintained, or whether it would be better to replace it. But it is clear that you are not qualified for the job - the sooner you accept that and arrange for a qualified person to handle it, the better for everyone (especially you).

If there is no other possibility than for /you/ to do the programming here, then at least hire a consultant for a few days to work with you and show you some of the basics. If you have a strong enough background in programming or electronics, that might be enough to give you a chance.

Reply to
David Brown

not

show

stuck.

register

register

chance.

I know sometimes its hard to understand a question. Everyone has the right to learn on their own and I am doing my part.

These are two simple basic programs for UART configuration and watchdog kick. I was new with this kind of processor as its an old one and never had to deal with a watchdog scenario, I just posted my questions as I was unfamiliar with the environment and as I had only worked with PICS and IAR's. Sorry for the trouble you had.

--------------------------------------- Posted through

formatting link

Reply to
srao

Could you please tell us if you are doing this as a job, or as a hobby? And if it is a job, what is the scope, and why are you doing it? From your posts so far, you are going to need guiding and help with a great deal of work because you don't understand what you are doing - your problems are much bigger than UART configuration or watchdogs. If we know what you are trying to achieve here, we can give better advice. That advice might be in showing you how to clear a bit in a port - but it might also be advice on a book to read, suggestions for replacing the microcontroller and toolchain, or simply to hire an experienced developer for the job. Clearly the advice will be very different if this is paid work or home study.

People in this group, myself included, are very happy to encourage people to learn about embedded development. We are a good deal less keen on helping someone do a professional job for which they are not qualified. (Well, there are some people here ready to do that - but they will want paid for their consultancy!)

Reply to
David Brown

As Rick already said, it is unclear what you are trying to achieve with the above code. The code shows a lack of knowledge on C programming and on basic processor operating principles. This is OK if you are just learning, but if this is a job... So please tell us what context this is in.

I do know some PICs (ouch, long time ago), but have never heard of IAR's.

How do you expect to clear a bit in the registers with the above code? Why do you need to repeat this 2000 times? If you wanted to do this on a PIC, how would you do it?

IIRC on a PIC you always had to load stuff into the W register before you could do anything...

--
Stef    (remove caps, dashes and .invalid from e-mail address to reply by mail) 

Young men, hear an old man to whom old men hearkened when he was young. 
 Click to see the full signature
Reply to
Stef

On 2015-10-20 Stef wrote in comp.arch.embedded:

Sorry, not Rick but David.

Stupid missing attributions from embeddedrelated.

--
Stef    (remove caps, dashes and .invalid from e-mail address to reply by mail) 

And then there was the lawyer that stepped in cow manure and thought 
 Click to see the full signature
Reply to
Stef

by

TO EVERYONE WHO DIDN'T UNDERSTAND THE QUESTION: I am sorry its difficult for you to get the thing. I guess we dont share the same language. I don't find any point responding back to your comments.

TO EVERYONE WHO HELPED(understood the question): Thank you so much for your inputs. With your help I was able to get to the first step.. The watchdog. I think now i can get the UART working too. Thanks a ton.

--------------------------------------- Posted through

formatting link

Reply to
srao

--- clip clip ---

The OP seems to mix up processors and compilers. IAR is a Swedish companu producing compilers. Their compiler was once upon time the most popular for 8051's.

--

-TV
Reply to
Tauno Voipio

I didn't know that IAR was ever the most popular choice for 8051's - I thought that was always Keil, with IAR being the alternative option (and SDCC for those that prefer open source tools). So that's an interesting bit of history.

One of the key strengths of IAR is that they have compilers for a range of small micros, so the are popular for companies looking for consistency over several different small devices. They also work closely with manufacturers, and have often been the first or only choice at the beginning - such as for Atmel AVR or TI MSP430.

AFAIK, IAR never made a PIC compiler.

Reply to
David Brown

IAR's.

Hello all.

I got the UART working. Thanks for your help. Seems like the watchdog reset was not allowing the UART to function correctly.

Thanks all for all the suggestions and comments.

--------------------------------------- Posted through

formatting link

Reply to
srao

I can't say I understand much of this. Usually the watchdog is not active until activated somehow. Then you write alternating 1 and 0 to the pin to swing it which resets the watchdog timer so it does *not* reset the CPU. Also, all the CPU watchdogs I have seen are just mapped to I/O addresses that control it, not external pins. Is this watchdog a separate chip?

Is this not what you are picturing or do *I* not understand how your watchdog works?

--

Rick
Reply to
rickman

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.