News:

Let's find out together what makes a PIC Tick!

Main Menu

why the demo HPWM_Demo.bas is not working?

Started by Yves, Sep 11, 2024, 09:17 PM

Previous topic - Next topic

Yves

Hello all,

I'm trying to get my head to understand better the HPWM function to use on my project. I thought to get a sample from the PDS supplied with Positron to better understand the code but it doesn't work. I'm using an Amicus board that has a 18F25k22 chip. The chip is working, I tested it with some other routines. The HPWM_demo.bas  written by Les Johnson For the Positron8 BASIC compiler which I always trust. The code is compiling well. I use my oscilloscope to watch what is going on but I'm not getting any signals on any CCP pins. I just can't figure what is the problem. Your valuable help on this matter will be greatly appreciated. Many thanks in advance

Regard,

Yves
   positron.zip
Yves

Oskar-svr

#1
Hi friend, you are missing these instructions, you need to configure the ports as output.
greetings


Device = 18F25K22                              ' Use a device that has 4 CCP peripherals
Declare Xtal = 16
 
' Setup which pins are used by the CCP peripherals
' Note that for some of these, config fuse changes will be required

    TRISB=%00000000  '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    TRISC=%00000000  '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

   
    Declare CCP1_Pin = PORTC.2
    Declare CCP2_Pin = PORTC.1
    Declare CCP3_Pin = PORTB.5
    Declare CCP4_Pin = PORTB.0

    Include "HPWM.inc"                              ' Load the HPWM macros into the program

    Dim bLoop As Byte
    Dim wFrequency As Word

Yves

Yves