PDA

View Full Version : Solved: notes on annoying little issues



Probotics
- 24th May 2008, 23:06
So I've run into these issues during my last project and couldn't find anything out there on them so I'm posting them here on the theory that they will help someone someday.

One of the symptoms of insufficient clock speed (Mhz) is that Serin2 starts dropping the last bit in characters received. This means things like instead of an 's' you get 9 cause you lose the last bit of the ascii character.

Yes, you really do need a MAX232 and it really does need those capacitors.

Yes pull up resistors are part of your life now. No one mentions them, but they're assumed in a bunch of different places.

The number of port you are going to have problems is directly related to the number of functions the port can perform. Pick a port for general I/O that does A/D or comparitor function (let alone osc or other) and you'll be searching forever for the commands that turn it off.

Hope these help someone - would have saved me a bunch of time.

mackrackit
- 24th May 2008, 23:34
One of the symptoms of insufficient clock speed (Mhz) is that Serin2 starts dropping the last bit in characters received. This means things like instead of an 's' you get 9 cause you lose the last bit of the ascii character.
This is found in the PBP manual. States that anything over 9600 will need greater than 4mhz.


Yes, you really do need a MAX232 and it really does need those capacitors.

Depends on what you are doing if you need a level converter. The PBP manual tell when it is common to use it. Caps on MAX232 = DATA SHEET


Yes pull up resistors are part of your life now. No one mentions them, but they're assumed in a bunch of different places.
Again the PBP manual and all over this forum.


The number of port you are going to have problems is directly related to the number of functions the port can perform. Pick a port for general I/O that does A/D or comparitor function (let alone osc or other) and you'll be searching forever for the commands that turn it off.
The manual and this forum and the data sheet.

So... you are basically saying that you did not read a whole lot.

skimask
- 25th May 2008, 00:25
So... you are basically saying that you did not read a whole lot.
Maybe this person doesn't have a PBP manual...
You know what that means...

sinoteq
- 25th May 2008, 04:55
What people tend to forget is that a PIC with code is only a part of the project. Most problems when starting a new project does not come from the PIC or the code, it comes from the hardware around the PIC. This is when engineering skills come into play and of course the old Blinky program.

Imagine you are an expert in engines and you start out building a car. Well expert as you are with engines that part is not a big problem but maybe you have never seen a transmission before thus making a car is almost outside your knowledge. What I am saying is that both the PIC manual and the manual for PICBASIC does not tell you much about the hardware parts around the pic. If they did they would probably be much thicker and still not really usefull because there are as many solutions to a problem as there are engineers involved. The more project you make the better understanding you will get regarding the interaction between hardware and software and the more solutions you can bring out ready to be used from your "little bag of engineering tricks". Some people, like Melanie, can make the hardest projects look so easy, but just because it looks easy for them does not make it easy for you unless you have reached their level or they are in your team. Please remember that even the experts today started out as beginners but that was some years ago....

On a more personal note I have a feeling that the tone of this forum has changed and it is not to the better. By the way manuals for PICBASIC can be found on the MELABS webpage, hardly a secret for anyone.

skimask
- 25th May 2008, 05:50
What people tend to forget is that a PIC with code is only a part of the project.............
This is when engineering skills come into play and of course the old Blinky program.
And quite a few of those 'problems' (ADCON, timing issues, 9600+ baud @ 4Mhz, etc.etc.) are at least briefly mentioned in the PBP manual...AND I would bet that MOST are easily found using a simple search here. After all, the person(s) probably did some sort of search to find these forums...so that rules out not being able to use a search.


What I am saying is that both the PIC manual and the manual for PICBASIC does not tell you much about the hardware parts around the pic.
That's why there are datasheets for both PICs and transmissions...


The more project you make the better understanding you will get.....
Which is why a lot of 'problems' end up right back at building Blinky LED #1.


Please remember that even the experts today started out as beginners but that was some years ago....
And some years ago, these forums didn't exist, and neither did the Internet as we know it today...therefore, about the only option was to read the datasheets and various other manuals. Heck, I didn't discover this site until Jun '05, had my MP3 player running back in '99 or so. Guess where I got all my information from before I got here...


On a more personal note I have a feeling that the tone of this forum has changed and it is not to the better.
I have a feeling you're right...duh... Reminds me of that one school principal in 'Back to the Future'..... SLACKERS!!!


By the way manuals for PICBASIC can be found on the MELABS webpage, hardly a secret for anyone.
Yep, it's a good manual too....for PBP 2.45 (?). And anytime somebody says they don't have a green hardcopy PBP manual, it rings a bell that tells me that somebody has a pirated copy. I mean really...if you're going to spend $250USD on software, you probably aren't going to throw away the manual for it. Lose it? Maybe...Doubt it though...

Probotics
- 25th May 2008, 20:50
Actually I do have a now dogeared original copy of the PBP manual. I got it when I bought Picbasic Pro. The PBP reads clock speeds of above 4Mhz MAY be required. May in my case meant is and I take from your comment that the same is true for you. I can only imagine the snarky comment about not having a manual is suggesting I steal software instead of paying for it. Back off from me and join the MPAA (or your local equivelant) if you want to go witchhunting. There are a lot of people there you would probably get along with.

I can actually use a search too, believe it or not. I also did not post a bunch of foolish questions - instead I searched both this forum and others and solved my problems by myself. I mentioned these things because they were the issues I had the most challenge with and wanted to help others. Note: In one case I got mixed up and posted a request for clarification here - thanks to those that responded.

>Pull up resistors
>Again the PBP manual and all over this forum.
Um no - the manual mentions one pull-up in an unexpected output and a couple of times in relation to resets. Its possible they're all over the forum. The issue I had with pull ups was actually related to weak pull ups inside the chip and the issue that they are associated with some ports but not others. If you are only acquainted with smaller chips you may not realize that they aren't on all ports. Yes its in the Datasheet - somewhere in the 300+ pages, but you kind of need to know that you should be looking for it in order to look for it and find it out. Now I know and will check going forward.

>>Depends on what you are doing if you need a level converter. The PBP manual tell when it is common to use it. Caps on MAX232 = DATA SHEET
Actually many of the PIC data sheets and quite a few posts indicate that you may be able to get away without using level conversion. I found this like the 4Mhz issue - its a 'may' or 'might' and there is info out there suggesting both ways, but if you don't know about the peripheral you are connecting to you had better assume its required and go for a level shift. There also seem to be less complicated solutions than the MAX232 that don't require the caps.

The issues with ports and multiple functions was not a simple one for me. While finding the article on fuses was quite helpful (Thanks Melanie - you are superb and a wonderful person for helping as you do). Regardless whether a special function of a port was on or off by default and whether that function would interfere with the port's normal i/o (or for that matter just interfere with its input or just its output) did not seem to be intuitive to me. ADCON and such are simple, but what about when you don't have say a CMCON and need to disable the comparitors? Some chips have two comparitors - each with its own controls of course but search for CMCON and you'll get nothing. The bigger processors are a major step up from the little ones. I've been living inside a PIC16F877 datasheet for ten hours a day for a week now and I am just beginning to feel like I have a handle on it even though I should be able to recite passages soon.

Sinoteq - good point. While I had all the programmer, compiler, IDE, eval boards, etc. the fact is when a chip just sits there and doesn't respond the way you want it you are going to have to break down the modules and test each part. That means you need some way to monitor serial in, serial out, keypad action, etc, etc as individual elements. You can't plop the chip into your final project and test it there - there's no way to find out what is wrong.

Again thanks to all that keep this forum alive and non-bitter. I've found historical posts a great source of information and hope to eventually be able to contribute as well as benefit from it.

mister_e
- 26th May 2008, 20:02
Here's some rubbish English explanation that comes to mind, based on my own experience.

PBP manual... good enough?
I tend to say yes, it's not an Microcontroller lessons, not either an electronic basics lessons. It explain each compiler functions as it has to be explained. Sure enough it miss the Config Fuses section though.

Manual do it's job. Pull-up, pull-down, extra hardware, decoupling caps, power supply, hardware layout, breadboarding... it's electronic basics lessons... which haven't to be covered by the PBP manual.

Extra Feature of the PIC
This one is one of the most common issue, this haven't to be covered by the PBP(C) manual... it is already covered in all respective piece of hardware datasheet... but people seems to barely read them... kinda sad. I'ts no way engineering tricks...it's datasheet reading. Everybody MUST do it... but forums exist, so other would do for you when question comes in. We haven't forum when i was at school...

Engineering tricks
There's no such things that really exist. There's conventional design rules, much more conventional rules and then the common sense practice... which are covered in any decent electronic lesson. Sure enough, we all have our own tricks discovered by any smoke-tests, bench tests.. and maybe sometime by using any kind of Sim software.. that's hardware. There's probably some programming tricks... but this imply you waste, spent some time on doing it. Problem is... not a majority of people doing this.. it's a kind of fear or something like that. One thing i'm not shy to say, if it wouldn't be this forum, i wouldn't probably that interested and experimented like i am right now. Maybe because i'm not afraid of reading datasheet and experiment with.

As i often said here and there... what will be the worst case? Compilation errors or it simply doesn't work... WHAT'S THE BIG DEAL? Learning opportunity... period. Where the fear of learning new stuff comes... i don't know for sure, everybody's different... maybe because i'm a lab rat and have no real social life :D

I learned MicroController at school in 90's... and we learned Z80 :eek: I learned PIC myself from scratch and by reading/helping other in this forum. I have the same resource as anyone, the same datasheet, the same manual, the same internet connection... maybe just more time to waste... maybe... could be also called... Time and interest in solving others problem BUT learning new tricks from it and later apply it in my own designs.
<hr>
I may agree that the "tone" of some user may have changed... is this motivated or not.. i don't want to know, but being member of 11 different forums (french/english) i can tell you this... people are quite polite in here.