BasicMicroUK - Forums

MBasic HPWM question
Page 1 of 1

Author:  wizard1 [ Sat Jul 03, 2010 9:48 pm ]
Post subject:  MBasic HPWM question

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?


Author:  kenjj [ Sun Jul 04, 2010 12:59 am ]
Post subject:  Re: MBasic HPWM question

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.

Author:  Acidtech [ Sun Jul 04, 2010 5:32 pm ]
Post subject:  Re: MBasic HPWM question

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.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group