BasicMicroUK - Forums
It is currently Mon Aug 10, 2020 6:37 am

All times are UTC [ DST ]

Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: MBasic HPWM question
PostPosted: Sat Jul 03, 2010 9:48 pm 

Joined: Wed Aug 20, 2008 5:57 pm
Posts: 27
I know I'm a fish out of water here but I'm still trying to use MBASIC to crank out products. I have moved to the 16F887 from the great old 16F877.
Question #1: The 887 seems to react strangely to pause and pauseus. If I ask for pause 1, hoping for a 1 msec pause, I get something around 2msec. Even for long pauses (pause 1000) the actual number of milliseconds is much longer and not too predictable. Once I figure out by trial and error what number to put in to get the pause I want, then it works fine. Too bad, since It lowers my coding efficiency greatly.
Question #2: The 887 has three pwm pins (RC5/P1B, RC6/P1C, RC6/P1D) that I can't access with the HPWM command. Is there a secret HPWM command to use those pins or doesn't the new compiler recognize this capability for the 887?


 Post subject: Re: MBasic HPWM question
PostPosted: Sun Jul 04, 2010 12:59 am 

Joined: Mon Aug 18, 2008 1:26 am
Posts: 799
Location: CA bay Area
Hello Wizard.
Did you set the proper clock type and clock speed in the set up menu after starting the new file for this PIC? There are eight predefined MHz settings as user buttons, but I believe you can hand enter the value if you are using a non-standard clock speed. And you want High Speed with a crystal or resonator. These settings affect timings, like PAUSE and Baud rates.

BMicro did install the definitions for the 16F887, so should largely work. BUT there are no guarantees, as IIRC they never fully tested all the new definitions. Then again, all the new registers in the -887 should be in the definitions, so you can read how things work in the -887 data sheets and then assign bit settings to the registers that control the function you want. Thus you can take advantage of the extra ADCs, PWM changes, individual settings for weak pullups on PortB, new interrupts, and other goodies. Hell, you can probably even invoke the internal 8MHz clock, maybe!

Although BMicro says they no longer support legacy compilers (before Studio, Atom or Pro), simple questions from commercial customers may still get an answer. Try and see what happens.
Take care.


 Post subject: Re: MBasic HPWM question
PostPosted: Sun Jul 04, 2010 5:32 pm 
Site Admin
User avatar

Joined: Thu Mar 01, 2001 7:00 pm
Posts: 1316
Location: Temecula, CA
1. Check you have the correct OSC MHZ set in the config.
2. HPWEM only supports the regular CCP pins. THe extra PWM capable pins are for special modes of the hardware PWM that HPWM doesn't know anything about. THose extra PWM pins are not independently controllable. You need to read the section on PWM in the 886 datasheet to understand what I mean. You can set up the hardware PWM directly using the PICmicro registers without using HPWM.

Tech Support
Basic Micro - Robotic Technology Evolved

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]

Who is online

Users browsing this forum: No registered users and 0 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group