PIC18F1320 HPWM on 2 pins


Closed Thread
Results 1 to 22 of 22

Hybrid View

  1. #1
    Join Date
    Jan 2008
    Location
    Selm, Germany
    Posts
    116


    Did you find this post helpful? Yes | No

    Default Re: PIC18F1320 HPWM on 2 pins

    Hello Acetronics2,

    i installed PBP3 and everything on my Laptop which runs Wndows8. But still get this "Not all words are hex" warning while programming. Will hardware test it at the weekend.

    thanks for your input.

  2. #2
    Join Date
    Jan 2008
    Location
    Selm, Germany
    Posts
    116


    Did you find this post helpful? Yes | No

    Default Re: PIC18F1320 HPWM on 2 pins

    Hello Folks,

    so at least I got it working. No loud laughs please, I'm too old to stand it.
    Code is like this:
    TX
    '************************************************* ***************
    '* Name : 16F88debug1 *
    '* Author : MUGELPOWER/2 *
    '* Notice : Copyright (c) 2017 [select VIEW...EDITOR OPTIONS] *
    '* : All Rights Reserved *
    '* Date : 08.12.2017 *
    '* Version : 1.0 *
    '* Notes : WORKS! *
    '* : *
    '************************************************* ***************


    Define OSC 4
    Define ADC_BITS 8 ' Set number of bits in result
    Define ADC_CLOCK 3 ' Set clock source (3=rc)
    Define ADC_SAMPLEUS 50 ' Set sampling time in uSec
    DEFINE DEBUG_REG PORTB
    DEFINE DEBUG_BIT 2
    DEFINE DEBUG_BAUD 2400
    DEFINE DEBUG_MODE 0
    DEFINE DEBUG_PACING 1000

    TRISA = %11111111 ' Set PORTA to all input
    ADCON1 = %00000010 ' Set PORTA analog

    CMCON = 7 ' Disable analog comparator
    ANSEL = %01000000 ' set AN6 (RB7) as analog, others to digital

    RX VAR WORD


    PAUSE 1000 ' lcd settle time
    DEBUG 10,13

    Main:
    ADCIN 6,RX ' Read channel 6 (RB7)


    DEBUG "*.*",DEC3 RX ,13,10 ' dec3 is important

    Goto Main


    End

    RX:

    '************************************************* ***************
    '* Name : 16F876ADEBUGINa *
    '* Author : MUGELPOWER/2 *
    '* Notice : Copyright (c) 2017 [select VIEW...EDITOR OPTIONS] *
    '* : All Rights Reserved *
    '* Date : 08.12.2017 *
    '* Version : 1.0 *
    '* Notes : WORKS! *
    '* : *
    '************************************************* ***************


    DEFINE LCD_DREG PORTB
    DEFINE LCD_DBIT 0
    DEFINE LCD_RSREG PORTC
    DEFINE LCD_RSBIT 0
    DEFINE LCD_EREG PORTC
    DEFINE LCD_EBIT 3
    DEFINE LCD_LINES 4
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50


    ' Set Debugin pin port
    DEFINE DEBUGIN_REG PORTC
    ' Set Debugin pin bit
    DEFINE DEBUGIN_BIT 7
    ' Set Debugin baud rate (same as Debug baud)
    DEFINE DEBUG_BAUD 2400
    ' Set Debugin mode: 0 = true, 1 = inverted
    DEFINE DEBUGIN_MODE 0
    DEFINE osc 4


    CMCON = 7
    CVRCON = 0
    adval VAR WORD
    RX VAR word





    TRISC = %10000000

    TRISA = %11111111 ' Set PORTA to all input
    TRISB = %00000000 ' Set PORTB to all output
    ADCON1 = %00000010 ' Set PORTA analog



    Pause 1000 ' Wait 1 second
    LCDOUT $FE, 2
    LCDOUT $FE,$C0,"HELLO"
    PAUSE 2000

    Main:


    DEBUGIN [WAIT("*.*"),DEC RX] 'dec is important


    LCDOUT $FE, 2
    pause 100

    Lcdout $fe,$C0 ' Move cursor to beginning of second line
    Lcdout "Ext=", DEC3 RX ' Display the decimal value


    Goto main ' Do it forever



    End

    Two main problems before:

    1. yes Scampy youre right: Main not Loop
    2. ADCON1.7 = 1 had to be erased, after that the reciever shows 0 to 255 and not 0 to 3.

    Thanks for your help.
    Thanks Crownhill for the fast delivery of PBP3

  3. #3
    Join Date
    Jan 2008
    Location
    Selm, Germany
    Posts
    116


    Did you find this post helpful? Yes | No

    Wink Re: PIC18F1320 HPWM on 2 pins

    Hello Acetronics2,
    now I guess I know how to post pictures.

    Name:  20171208_211220.jpg
Views: 1925
Size:  560.5 KB

Similar Threads

  1. PIC18F1320 Config Help
    By iw2fvo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 8th June 2013, 06:31
  2. Timer 3 config for HPWM using remappable pins
    By jimbostlawrence in forum General
    Replies: 1
    Last Post: - 5th December 2012, 14:26
  3. PIC - 8 Pins - 6 Output Pins ?
    By DanPBP in forum Off Topic
    Replies: 0
    Last Post: - 22nd October 2007, 00:23
  4. Setting up 5 HPWM pins on 18F4680
    By tcbcats in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 2nd August 2006, 05:54
  5. Compiling error with PIC18F1320
    By mazlan in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 26th November 2004, 01:01

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts