PIC18F1320 HPWM on 2 pins


Closed Thread
Results 1 to 22 of 22

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,653


    Did you find this post helpful? Yes | No

    Default Re: PIC18F1320 HPWM on 2 pins

    Code:
    Define ADC_BITS 4 ' Set number of bits in result
    from manual
    You may set ADC_BITS to values 8-16, but in reality the result will either be 8-bits or the maximum precision available (10-bits, in most cases).
    Code:
    DEBUG #adval
    could send 1 to 5 ascii chrs for a word value {adc value 1 to 4 chrs }

    Code:
    DEBUGIN 1000,timeout,[adval]
    how is that meant to work ? you will also discover debug sends/receives bytes not words

    DEBUGIN 1000,timeout,[dec adval]
    might have a chance.

    simplistic async coms like this is seldom reliable, especially if the receiver has other tasks to perform other
    than sitting there waiting for a transmission.

    packetizing data in stx/etx codes and preferably with crc too is a better choice
    Warning I'm not a teacher

  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 Richard,
    o that... Itried for hours, read many threads here in the forum, tried "dec,dec2,dec3 , hex, bin,#" and without, ADC 8 bits, ADC 4 bits. It makes simply hardly a difference. Possible outcomes are:
    0 to 3
    000 to 003
    48 to 51

    or nothing.

    when I change

    DEBUG adval

    into

    DEBUG adval,10,13

    I will receive a 3 digit fast running number, impossible to read and no correspondece to the position of the poti for the analog Input.




    I got the input in the 16F876A from 0 to 3
    which is in the direction i need but way too coarse, then changed DEBUGIN_MODE 0 to 1 at the receiver still having DEBUG_MODE 1 at the transmitter and what: made no difference receiveived 0 to 3.
    That was the point when I realized that Iīm stuck.

    Of course tried serin, serin2,hserin. Nothing worked.
    Debug/Debugin shows at least anything at the receiver end.

    maybe my include file for the 16F88 is corrupt because I changed something 10 years ago. I will control that.

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    2,653


    Did you find this post helpful? Yes | No

    Default Re: PIC18F1320 HPWM on 2 pins

    DEFINE DEBUG_Mode 0

    IS INCORRECT and simply won't do anything

    pbp defines must be uppercase


    try it this way tx:-

    DEFINE DEBUG_MODE 0
    DEFINE DEBUG_BAUD 9600



    DEBUG "*.*",DEC5 GLCDBM ,13,10




    rx


    SERIN2 PORTC.7,84,[ WAIT("*.*") , DEC RX] ;





    if this is still your goal
    So I guess its waaaay easier to use two
    PICs than to scramble everything in just one
    then you are sadly misguided , its never easier . get a better chip that's way easier
    if your goal is different why not start a more relevant thread

    either way post your latest code
    Warning I'm not a teacher

  4. #4
    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 Richard,

    thank you for your fast answer.

    I Know about the upper case sensitivity of Defines but it was obviously too late yesterday.

    Didnīt know DEBUG and SERIN2 can be mixed.

    I always thought how would one PIC know when to receive without handshake. Tried HSERIN for that with the RX and TX lines.

    Didnīt work of course althoug both PICs have a USART.

    Will try that at home this evening because its about noon by now and Iīm at work. Nothing with PICs, just metal and engines.

    regards

    Mugel

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


    Did you find this post helpful? Yes | No

    Lightbulb Re: PIC18F1320 HPWM on 2 pins

    Hello Richard,

    by using the right PIC you may think of something like this:

    http://www.microchip.com/wwwproducts/en/PIC16F15323

    I donīt believe PBP supports that one or similar new ones.

    Iīm shure with 10 (or 30) more IQ points I could program an older one thats supported by PBP

    but Iīm stuck to my own miserable brain.


    regards
    Mugel

  6. #6
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: PIC18F1320 HPWM on 2 pins

    Actually Mugel, PBP3.1 does support the PIC16F15323. At the cost of a few extra pins might I suggest something like the PIC18F26K22. It has 2 USART ports and can run @64Hhz.
    Dave Purola,
    N8NTA
    EN82fn

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


    Did you find this post helpful? Yes | No

    Default Re: PIC18F1320 HPWM on 2 pins

    ahhh,

    you are trying to talk me weak for buying PBP3?

    may work......

  8. #8
    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 Richard,

    i tried your example and i get compilation error "DEBUG " bad expression or "SERIN2 bad expression"

    I even used a PBP example that was delivered with my software and I get the same "HSERIN bad expression" compilation error.
    So I have a software problem but I donīt know where to search.

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