Continue to Site

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.

  • 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.

Coding problems on 16f88

Status
Not open for further replies.
I just got back on since last night.

I am overwhelmed by the responses. Thank you.

I must get back off line for several hours. As soon as possible I will try to do the things that have been suggested.

I would appreciate someone running the code to see if they get the same results. I realize that it would be some bother to set the system up on a bread board. My part might be bad. I have used two parts but both are samples which really shouldn't matter but both could possibly bad.

I would like to reiterate it runs fine for hours and hours on a 627a. It gains about a minute an hour on the 627 but I am sure that's due to the inacurate internal oscillator. The 88 has an Oscillator tune register which should get the inaccuracies out.

Thanks again I will be back on as soon as possible.

Steve
 
Hmmm, how are you getting the .hex into the chip? via a programmer or via a bootloader? If it's a bootloader, you are running with the bootloader's configuration which may not have no_mclr and/or wdt_off. Either of which will lead to resets.

I would put a 10K pullup on /mclr anyway just to see what happens.
 
Get off the code folks. This morning right after I made my last post I pulled the 88 out of the bread board and plugged the 627 in. Same bread board, same power supply, same LCD, same wiring. The 627 is now showing 05:12:some seconds. It's clicking along just as happy as a pig in a mudhole. The code is what I sent on my first post except for 2 changes, the Config statement was changed and all reference to OSCCON was removed and of course the device statement. If it was a timing or code problem the 627 would react exactly like the 88.

The data sheet for the 88 says that if the WDT is set to off in the config Statement it can be toggled on/off by setting bits in the WDTCON register. It also say that if it is set on in the config statement it cannot be overriden. It is of course set off in the Config Statement but the prescaler is set to WDT I think in the OPTION Reg. I am now wondering if this setting might be turning the WDT back on.

I intend to try the following thing: manually set the WDT off again in the WDTCON reg, manually disable timer1 or timer2 interrupts (I am assuming they have interrupt capability) and take these actions the last thing in the setup.

The only 2 other things I can think of is that the part is bad or the programmer is messing up.

I want to discuss the programmer a little now. philba I'm using a programmer to to get the hex code into the aprt. The programmer is a Velleman K8048 programmer and small project board kit I put together several months ago. It has 6 LEDs and 4 push buttons besides the programmer. When I first got interested in the 16f88 I noticed that my programmer did not support it. I contacted Velleman and they verified that the programmer did not support the device. What that meant was that the software furnished with the programmer did not support the device. I downloaded IC-PROG. After many hours of internet searching I finally found out how to config the IC-PROG for the programmer. I think it like a JDM programmer. That software and programmer are what I have been using. I think I programmed the 627 with the Velleman software.

BTW the #1 pin on the 627 is broken off. Maybe I should break the #1 pin off the 88. Just kidding.
 
note that the mclr and wdt config bits are in the same location of the config word in both the F88 and the 627/628/648 so it's unlikely the programmer is messing up. However, I would read back the config word on the F88 to verify it.

maybe this is a dumb question but when you build the F88 version, have you selected the F88 in MPLAB? I don't believe the LIST directive actually sets the MPLAB processor type. at least, that is what the mplab help section on LIST seems to imply. You can test this by setting ANSEL to zero (clrf ANSEL). ANSEL doesn't exist on the 627. If it gets an error then you are still building for the what ever the configure->select device says.
 
Last edited:
As I have a 16f88 connected up, I tried your code. I had to change the config to turn on debug and mclr so that it would work with a Inchworm. The first thing I found was it didn't get past the check for the oscillator to be stable. This is because before it you select bank 0 and OSCCON is in bank 1.

After changing the above, it worked flawlessly. I can't see how the above changes would affect anything so I suspect your problem is hardware related.

Mike.
 
I made the changes I talked about above of course with no results. I also have a 10k pullup on mclr. I got a new pic out and programmed it with the change in the banksel that pommie talked still with no result.

I guess I need to try to check my programmer out some way. If anybody knows how to set up the IC-PROG for this programmer please let me know. I guess I will program the 627 with it to see if it messes up.

I did have the right device selected in MPLAB.
 
Pommie said:
IMSlo,

Can you increase the clock speed to 8 meg to see if it is timing related. I expect it to either run correctly (only double speed) or crash consistently.

Mike.

Hi all
permit a childish quesation please !!

i didn't find osc config word-- in the FIXED.asm ---is it working on internal clk or what ?

just for enlightenment

sarma
 
mvs sarma said:
Hi all
permit a childish quesation please !!

i didn't find osc config word-- in the FIXED.asm ---is it working on internal clk or what ?

It doesn't matter what oscillator it uses, it still needs setting - and it SHOULD be done in the source code, although you can often set it in the programmer software during the programming process.
 
IMSlo said:
........
I guess I need to try to check my programmer out some way. If anybody knows how to set up the IC-PROG for this programmer please let me know. I guess I will program the 627 with it to see if it messes up.

.


Hi could you please indicated your programmer ?

incidentally why not read the device and check once instead of doubting the programmer.

for setting the programmer on ic prog105D
go to settings -- hardware-- press programmer-- there you select the right one--

be sure to choose the concerned COM port as this S/W doen't seem to have auto detect .
enable 2000/nt/xp

the programmer shold work
 
sarma,

I did set the oscillator in the config statement. (_INTRC_IO) It is the internal osc. It is set to 4mhz in the OSCCON register.

I think I stated somewhere above the programmer I am using is the Velleman K8048.

I downloaded WinPic since my last post. This software has a specific setup for my programmer. I program the PIC. The software says no errors. It can be verified over and over always saying everything is ok. I plug the PIC into my board and get the same deal. I have done everything I know to do. I have even intentionally selected the wrong device in the programmer software. It immediately detects the error. I feel a little better about the programmer. Pommie says he can run the code so maybe it's my PICs. I have ordered some more PICs.

Thanks for the reply. I thought this thing was about dead.
 
Find a programmer that supports the 16F88, that's the problem with many homebrew programmers.

Wonder how long till it supports the 16F88x series PICs out today. The 16F88 has been out for ages and few third part programmers support it.

Stop blowing chips, I give away the ICD2 schematic and it's easy to build, basically all you need is a max232 and 16F877A if you've got a power supply. It WILL program 16F88 and debug em too.
 
William At MyBlueRoom said:
Find a programmer that supports the 16F88, that's the problem with many homebrew programmers.

Wonder how long till it supports the 16F88x series PICs out today. The 16F88 has been out for ages and few third part programmers support it.

Bear in mind, it's NOT the programmers, it the SOFTWARE that doesn't support them - however, in the Velleman case I seem to remember problems if you set the internal oscillator, due to it's limited design.
 
I think my programmer is ok. I sometimes no, most times "read the instructions after everything else fails". This latest sofware "WinPro" that I downloaded seems to be very good. Buried deep in the documentation is the instructions about which driver to use. There are several choices and the recommended one is "no driver" use windows API. I had not noticed but the software was continuously give me an "unable to initialize programmer" error message. After I changed the driver to the recommended one that error went away and now I get a message saying "programmer initalized" each time I start the software up with the programmer hooked up. I programmed the chip again but alas now I got a problems with my display. I think I must have a bad connection. Whether the chip is in or out the display is the same. It is getting power all the cells are black but it not getting initialized and there seems to be no communication between it and the chip. Please don't jump to conclusions this only happened a day or two ago and has been the problem all along. I would like to work on it continuously but SWMBO (She Who Must Be Obeyed) has spoken and if I want to continue to live in this house I must start building a desk for my granddaughter that must be done by Christmas and working on a new floor that must be installed. So I guess I will work on the PIC between 10 pm and 1 am.
 
I need to make a correction in my last post. I said "Please don't jump to conclusions this only happened a day or two ago and has been the problem all along." I meant to have said "Please don't jump to conclusions this only happened a day or two ago and has NOT been the problem all along."
 
IMSlo said:
I ......... There are several choices and the recommended one is "no driver" use windows API. ........... So I guess I will work on the PIC between 10 pm and 1 am.
Hi IMSlo

i didnt get you properly-- did you feel that you need a driver with winows API-- if so, icprog105D has it .

please go thro the spll dataprovided by the website ic-prog.com

if you configure the driver to work with WINXP and thereafter the Stettings- Hardware page shows working on WINDOWS API. hope this serves you

you are perfectly right to feel it is driver which does or need configuration. At times you may need simple things like terminate a pin with 10K to gnd etc.. i saw your K8048 manual-- it really nice. it is only aquestion of proper device driver with component specific data.

if i remember winpic prog has given a way toadd devices not exisitng in their driver -- please see this aspect also.

All the best enjoy Cristmas times

regards

sarma
 
Hi sarma,
I have settled on WinPic software. I like it better than any I have seen. As I said before it specifically lists support for my programmer and has a setup file for it. On ICPROG I have to use JDM programmer type and use setting that someone else on the internet says is right. I have the driver problem straightened out. I don't think the chip has been completly and/or properly programmed up until now. I think this software will do it. I am anxious to get my LCD fixed so I can tell if it will or not.

Steve
 
IMSlo said:
Hi sarma,
I have settled on WinPic software. I like it better than any I have seen. As I said before it specifically lists support for my programmer and has a setup file for it. .............
Steve
Hi Steve

Yhat is Nice-- perhaps you might have downloaded ver3.60 of winpic800 -- today itoo did. it is really good.

All the best to you you and best of Christmas times Steve

regards
 
I'm Running!!!!!!!!!!!!!!!!!!!!!!!

I finally got my timer running last night. I have been working on this every spare minute since my last post.

I had to completely scrap the TMR0 timer and use the TMR1 timer. I tried everything before doing this but nothing worked.

I have my internal clock set for 250khz. This is the fastest speed I could run and stay in a 16 bit timer without a prescaler. I am preloading the TMR1H & L registers to get a one sec interrupt. I am disabling TMR1 and clearing TMR1H & L in the interrupt service routine. I considered just adding to these registers but read somewhere that this can cause unexpected results. I tried to count the instructions between the interrupt and reenabling TMR1 and compensate for this in the preload. I might be a little off on this number.

I got one more question. Can data be saved while the pic is turned off? I wanted to use this timer to keep track of time spent on woodworking projects. The reason I was so adamant about using the f88 was it's low power consumption feature. Sometimes there might be several day between work sessions on a project. If the pic could be turned off and still retain the cumulative data would be much better than the low power feature.

My next project is to add a button to start and suspend the timer.

I am attaching a copy of the latest version.
 

Attachments

  • TMR1_Timer.zip
    3.2 KB · Views: 124
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top