• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Hserout in Oshonsoft causing unrecognisable digits

camerart

Active Member
Thread starter #1
Hi,
I'm using a PIC with Oshonsoft.
I am sending an HSEROUT via radio link to a computer terminal.
Normally I get sensible results but occasionally I get gobbledygook.

Here is a section:€xx[00]x[00]x[00]xø€[00]€[00]€[00]€[00]ø€[00]€[00]€[00]€€€xx[00]x[00]x[00]xø€[00]€[00]€[00]€[00]ø€[00]€x[00]€

What can cause this? I've tried changing the terminal BAUD rate, but still unrecognisable.

Camerart.
 

camerart

Active Member
Thread starter #2
Hi,
I've been trying various old programs with the same PCB/PIC, and one program showed sensible digits. This program has a different clock speed.
I have investigated deeply yet, as it's quite involved and different PICs e,g, 18LF46K20. 18F4620 etc
C.
 

camerart

Active Member
Thread starter #6
Hi E... Are you using internal crystal???
Hi I,
Yes internal Crystal.
I've had to change PICs over time and sometimes the settings get lost. I suspect the latest one I'm using 18F4620 has a different OSCCON and PLL or HS setting in the configuration BITs. I have tried and failed to get the PICs to run at 32MHz.
C.
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
#7
Thought so.... Its almost impossible to get an internal crystal perfect..... You have to use the OSCTUNE reg to get it to work
Datasheet said:
Tuning the INTOSC source requires knowing when to
make the adjustment, in which direction it should be
made, and in some cases, how large a change is
needed. Three compensation techniques are
discussed in
Section 2.6.5.1 “Compensating with
the EUSART”
,
Section 2.6.5.2 “Compensating with
the Timers”
and
Section 2.6.5.3 “Compensating
with the CCP Module in Capture Mode”
, but other
techniques may be used.
Each device is different
 

camerart

Active Member
Thread starter #8
Thought so.... Its almost impossible to get an internal crystal perfect..... You have to use the OSCTUNE reg to get it to work


Each device is different
Hi I,
Luckily, I added tracks for XTLS, so I think it may be a good idea to add them.
EDIT: Just ordered some 8MHz XTLS
C.
 
Last edited:

camerart

Active Member
Thread starter #10
They can run at 40Mhz so any.... 10Mhz seems the logical answer... BUT!! 8 will yield better baud rates... You'll need to do a bit of homework!
Hi I,
We got crossed messages there, I just edited the above message.
Just ordered some 8MHz.
Cheers, C.
 

Pommie

Well-Known Member
Most Helpful Member
#11
Are we talking bitbang or hardware? In hardware your speed has to be out by 5% or more to get these kind of errors. Errors can accumulate over long strings if only 1 stop bit is used. Using 2 stop bits causes each byte to reset the accumulated error.

Mike.
 

JonSea

Well-Known Member
#12
If the wrong clock rate is specified, you'll also get errors like this. Flash an LED on and off for 1000mS and verify the correct timing.
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
#14
setting in the configuration BITs. I have tried and failed to get the PICs to run at 32MHz.
This is also your issue..

If you select 32Mhz BUT!! you do't achieve it ( assume 8Mhz PLL not running ) then your baud is set incorrectly as Vlad will use the frequency setting and not the actual crystal speed... Post the whole thing and I'll tell you how fast its running..
 

camerart

Active Member
Thread starter #15
Hi,
I doubt it's clock selection or PLLEN, because I've been trying lots of different programs that work on other PCBs and are wired the same. These other programs have different OSCCON and PLLEN settings. I checked the CLKOUT PIN on an Oscilloscope and they are the same.

After I changed from 18LF4520 to 18LF46K20, this is when I started having difficulties. I now have removed all of the 18LF46K20 and replaced them with 18F4620. (I still have working 18LF4520 PCBs, but they have limited programs, because of memory size.

In the D/S there is reference to HSPLL, but this is not an option in Oshonsoft. The LED switches ON/OFF 1/sec by eye.
C.
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
#18
Just loaded your stuff into Oshonsoft.... I selected pic18f4620, but I noticed the pic18f46k20 in the text.... Oshonsoft doesnt support hardware serial on the K series.... Which chip should I test...
 

camerart

Active Member
Thread starter #19
When you set the PLL to on, the frequency has to be set to 32Mhz and not 8... Even if the internal 8 Mhz is used
Hi I,
OK.
Initially I tried to get PICs running at 32MHz, but after failing, I use 8MHz and no PLLEN till things get working,
Thanks.
C.
 

camerart

Active Member
Thread starter #20
Hi I,
OK.
Initially I tried to get PICs running at 32MHz, but after failing, I use 8MHz and no PLLEN till things get working,
Thanks.
C.
Hi I,
Note #15, I don't use the 'K' type anymore. I've removed the 'K' from the text.
C.
 
Last edited:

Latest threads

EE World Online Articles

Loading

 
Top