pulse simulation


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Noooooooooo....

    and how to place it in location 4 ????

    D.E.F.I.N.E. !!!!!

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  2. #2
    Join Date
    May 2006
    Posts
    27


    Did you find this post helpful? Yes | No

    Unhappy pulse simulation

    sorry bur i dont understand how use interrupt on a port.
    i m bad

  3. #3
    Join Date
    May 2006
    Posts
    27


    Did you find this post helpful? Yes | No

    Default pulse simulation

    I work but it is hard
    this code work

    ' pic16F877

    'cycle = !-!_!-!_!-!_!-!_!-!__!--!_
    ' i use lcd just to see W0
    ' Define LCD registers and bits
    DEFINE LCD_DREG PORTD
    DEFINE LCD_DBIT 8
    DEFINE LCD_RSREG PORTE
    DEFINE LCD_RSBIT 0
    DEFINE LCD_EREG PORTE
    DEFINE LCD_EBIT 1
    DEFINE OSC 4 ' use 20 MHZ oscillator

    INCLUDE "modedefs.bas" ' Include serial modes

    W0 var word
    W1 var word
    i var byte
    up var PORTB.4
    dn var PORTB.5
    rst var portb.6
    b0 var byte
    PO var portb.3 ' Define pulse output pin

    'initialisation
    ADCON1 = %0000111
    TRISA = %1
    w0=100
    i=0
    B0=0
    Low PO ' Initialize output polarity
    intcon=%0001000
    On Interrupt Goto bouton ' Define interrupt handler
    INTCON = $90 ' Enable INTE interrupt

    '*********************
    pulse:
    for i =1 to 5
    Pulsout 3,W0 ' Generate pulse
    pause W0/100 ' Intra-pulse delay
    next i
    Pulsout 3,W0
    W1=W0*2
    Pause W1/100
    Pulsout 3,W1
    'visualisation sur LCD
    Lcdout $FE,$C0,"W0 = ",dec W0," "
    Goto bouton
    '*********************
    inc:
    W0 = W0 + 10
    goto pulse
    '*********************
    decr:
    W0 = W0 - 10
    goto pulse
    '*********************
    reset:
    w0 = 100
    goto pulse
    '*********************
    bouton :
    disable
    button up,1,0,0,b0,1,inc 'si bouton1 sur port1=1 aller à calibration
    button dn,1,0,0,b0,1,decr 'si bouton1 sur port1=1 aller à calibration
    button rst,1,0,0,b0,1,reset 'si bouton1 sur port1=1 aller à calibration
    enable
    goto pulse


    but why on the piture the period after double pulse the low period its not equal w0?
    Attached Images Attached Images  

  4. #4
    Join Date
    May 2006
    Posts
    27


    Did you find this post helpful? Yes | No

    Default pulse simulation

    help please

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink Nothing strange.

    PAUSE Missing after PULSOUT 3, W1

    Goto Pulse instead of Goto Bouton ---- mais à quoi servent donc les interruptions ???

    et on termine en plaçant la visualisation dans le programme d'interruption juste AVANT le Enable !!! ( ça évite les affichages Ollé, Ollé ...)


    Alain
    Last edited by Acetronics2; - 14th August 2006 at 14:03.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6
    Join Date
    May 2006
    Posts
    27


    Did you find this post helpful? Yes | No

    Default pulse simulation

    to simplify :no button

    ' pic16F877

    'cycle = !-!_!-!_!-!_!-!_!-!__!--!_
    ' i use lcd just to see W0
    ' Define LCD registers and bits
    DEFINE LCD_DREG PORTD
    DEFINE LCD_DBIT 8
    DEFINE LCD_RSREG PORTE
    DEFINE LCD_RSBIT 0
    DEFINE LCD_EREG PORTE
    DEFINE LCD_EBIT 1
    DEFINE OSC 4

    INCLUDE "modedefs.bas" ' Include serial modes

    W0 var word
    W1 var word
    i var byte
    up var PORTB.4
    dn var PORTB.5
    rst var portb.6
    b0 var byte
    PO var portb.3 ' Define pulse output pin

    'initialisation
    ADCON1 = %0000111
    TRISA = %1
    w0=1000
    i=0
    B0=0
    Low PO ' Initialize output polarity

    '*********************
    pulse:


    for i =0 to 5
    Pulsout 3,W0 ' Generate pulse
    pause W0/100 ' Intra-pulse delay
    next i
    I=0
    Pulsout 3,W0
    W1=W0*2
    Pause W1/100
    Pulsout 3,W1 'double pulse ok
    pause W0/100
    'visualisation sur LCD
    Lcdout $FE,$C0,"W0 = ",dec W0," "
    Goto PULSE 'repeat cycle

    I want a double pulse in end cycle but before new cycle , i want simple pediod low but it not equal w0!!!

  7. #7
    Join Date
    May 2006
    Posts
    27


    Did you find this post helpful? Yes | No

    Default pulse simulation

    I remove lcd and it s ok

Similar Threads

  1. 2 Beam Optical Pulse Generator
    By WOZZY-2010 in forum Schematics
    Replies: 8
    Last Post: - 6th April 2010, 05:03
  2. Pulse Capture and byte building
    By boroko in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 21st July 2009, 02:59
  3. Single digit 7 Seg LED clock - PIC16F88
    By thirsty in forum Code Examples
    Replies: 4
    Last Post: - 17th July 2009, 09:42
  4. Replies: 3
    Last Post: - 13th September 2008, 18:40
  5. Pulse Frequency Multiplication
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 21st August 2005, 11:39

Members who have read this thread : 0

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