splitting output from a counter


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Nov 2008
    Posts
    41


    Did you find this post helpful? Yes | No

    Default

    Ok we finally got the code working. This picture explains it much better. The yellow trace is a 1.5Khz square wave. The purple and green traces are the resulting outputs.


    Code:
    @	__CONFIG _INTOSCIO & _FCMEN_OFF & _IESO_OFF & _BOD_OFF & _BOD_OFF & _CP_OFF & _MCLRE_OFF & _PWRTE_ON & _WDT_OFF
    
    DEFINE OSC 8           ' Internal 8MHz
    
    CMCON0 = 7   			'Comparators off
    ADCON0 = %00000000		'ADC enabled and right justified
    ANSEL = %00000000		'GPIO.0 and GPIO.1 analog input
    INTCON = 0				'INTERRUPTS off
    OSCCON = %01110000		'8 Mhz
    TRISIO = %000100		'GPIO2 input
    GPIO = %00000100 		'All outputs = 0 on boot
    OPTION_REG = %00101000	'
    INCLUDE "Modedefs.bas"
    
    
    
    A	VAR	word
    A=0
    TMR0= 0      						
    input GPIO.2						
    main:
    while TMR0 <= 5
    wend
    A = A+1
    TMR0= 0
    if A <> 5 then pulsout GPIO.5, 400		
    if A=5 then onepulse
    'TMR0= 0  								 pause		     						
    gosub main
    
    onepulse:
    TMR0= 0
    pulsout GPIO.4, 400						
    A=0
    gosub main
    Attached Images Attached Images  

Similar Threads

  1. Conway's Game Of Life
    By wellyboot in forum mel PIC BASIC Pro
    Replies: 45
    Last Post: - 28th May 2020, 07:14
  2. 20 Digit Virtual LED Counter
    By T.Jackson in forum Code Examples
    Replies: 9
    Last Post: - 19th November 2007, 06:02
  3. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 18:27
  4. Serious Serial Situation Setbacks...
    By Dansdog in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th February 2007, 04:46
  5. HSEROUT Newbie question/problem
    By Mark Scotford in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 11th July 2006, 15:44

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