On Wed, Aug 04, 2004 at 01:20:51AM -0700, Jason S wrote: - From: "Byron A Jeff" - Sent: Wednesday, August 04, 2004 12:31 AM - - - > A lot of people don't. We've gone round and round on this issue on the - list - > over the years. Here's my case: - - Well then let's not re-open the debate, but I do have a couple of - comments/question as someone making the transition from doing everything in - software to using the peripheral hardware. - - > Now all of the onboard periperals take a bit of coding to get going. But - > I tell you as you move from novice to late beginner/intermediate - developer, - > the ability to set and forget becomes invaluable. Need PWM at a certain - > voltage? Set and forget. Need to capture a ADC voltage? Again set and - forget. - > Sending serial? I think you get the idea. - - How do you learn to use all these things? There are a lot of great books - and tutorials on the F84, there is relatively very little on the newer - chips. A few months ago I used the ADC for the first time, I followed - through the app notes on the Microchip website while going over the - datasheet at the same time to see what I was setting (the app notes are - quite bad at telling you what bits you're setting and why, but the - datasheets simply list all the bits with descriptions and don't have a - comprehensive "to do that you set these bits like this"). After writing my - code, it wouldn't work. After hours of frustration, I found out (from the - datasheet) that there's a bit I have to set to turn on the ADC. The Midrange manual lays out the process in detail with example code written in PIC assembly. It describes each and every peripheral available on every part in the family. For example take a read of the operations section of the 10 bit ADC in the midrange manual (section 23-3, page 23-5). It outlines the exact process for using the module. Would this have helped you? Section 23-7 page 23-10 gives example code. Also all of the parts share essentially the same hardware modules. There is sample code and tutorials for the 16F628 and the 16F877. Fr. McGahee's PICUART code works virtually unmodified on any 16F part with a USART. We need more code/tutorials like that. - - Sure, it's my fault for missing it the first 20 times I read that section of - the datasheet, but there doesn't seem to be any available material to teach - you how to do something. A cleanly written, well documented source code - listing would have helped a lot. Take a read of that section and let me know if it would have helped. I think that there are many developers that are not aware of the Reference Manuals. - - > So you need a breakpoint very early on. Reason is that if you take the - tutorial - > path on the 16F84 road, you'll be led down all types of avenues that are - not - > really relavent to modern PIC development. - - Show me the tutorial road using the hardware peripherals then. I'd be quite - happy to take it. - - > Yes there is. It adds a much higher level of complexity to the process of - > coding once you get beyond the exemplars of the tutorial. While bitbanging - > works in isolation, once you start combining it to multiple tasks it very - > quickly gets very difficult to manage. - - As a beginner, you're not going to be combining it to multiple tasks. It's - important to understand what the peripherals do to use them properly. Right. But on the other hand you won't stay in tutorial mode forever either. Real systems virtually always have interconnecting components. Take my sunrise/sunset light controllers as a simple example. Code is here: http://www.finitesite.com/d3jsys/clock.asm It does all of the following: 1) Keep track of real time using a 32Khz crystal. 2) Uses a ADC interface to gather user input. 3) Drives a multidigit LED display. 4) Controls the lights via a relay interface. It's probably about second or third on a real project list for a novice. Being able to set/forget timer 1 and the ADC simplified it immensely. The point is that I agree that you learn them in isolation for teaching purposes. But soon enough you'll be doing combinations for real projects. And with using actual hardware, there are only limited interactions between the components, simplifying the complexity of such projects. - - > There's a vast difference between code - > simulating hardware and code that manages it. Even managing a simple set - of - > tasks such as doing serial while doing PWM while reading from the ADC can - get - > real tough if you have to bitbang each. - - If you've been reading my other thread about the LED stroboscope, that's - pretty much what I'm trying to do. I will be using the hardware peripherals - as much as possible. I don't think it's possible to get the PWM to do what - I want, so I will probably end up bit-baning the output (though I've seen a - few innovative suggestions that involve generating the pulses in an analog - circuit and using the pic as a frequency counter). Knowing how to do the - PWM in software is good here. No argument there. But you were able to make an informed decision about which to choose because you were aware of the choices. My point is to teach the hardware method first and its limitations, then move on to software. But that can only occur when the hardware is available to teach. - - - I've recently started playing with the 18F252, and I can not get the new - memory paging system to work. I've read the data sheet and microchip's - migration document, and I've tried the assembly code from there and it - doesn't work. If I write the code using the access bank, it works - perfectly, but I only have access to 128 file registers. If I make a tiny - change to the code to put my data in bank 1, the chip just sits there and - does nothing when powered. Obviously I'm doing something wrong, but I have - no idea what, and since it's not a 16F84, I can't find any documentation to - help. My solution has been to to just use JAL with the 18F252 (thank you, - Wouter) The 18F (and 30F) families are on my list of things to do. Of course language choice is another debate altogether. - - Sorry if this is a bit rambling, but it's getting pretty late. No problem. It's an important discussion. I agree with you about the lack of tutorials and documentation. We had extensive discussions about that during the several month long PIC beginner station thread. I believe it's something that we here on the list could do as a collective. But I doubt that anyone with the expertise to coordinate such an effort would have the time to do so. BAJ -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads