18f4550-problem output


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2008
    Posts
    85

    Default 18f4550-problem output

    hi,

    the output of 18f4550 is double i.e.suppose 1 led is on, but 2 leds are on instead.
    can anyone help?

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,637


    Did you find this post helpful? Yes | No

    Default Re: 18f4550-problem output

    Showing your code will help others to help you.

    Robert

  3. #3
    Join Date
    Apr 2008
    Posts
    85


    Did you find this post helpful? Yes | No

    Default Re: 18f4550-problem output

    the code runs well with pic16f (slightly modify it)

    problem with 18f4550 (particlar 74hc595) ?, all internal osc are disable and switch osc : off) osc set to XTPLL.
    problem appears in the program.

    INCLUDE "modedefs.bas"
    include "ALLDIGITAL.pbp"
    'ADCON1=7
    TRISB=0
    portb = 0

    PAUSE 20
    DEFINE OSC 8

    II VAR BYTE
    X VAR byte
    W VAR BYTE
    MM var byte
    KK VAR BYTE

    symbol DATb = portb.0
    symbol STLb = PORTB.1
    SYMbol CLKb = portb.2

    peek_ind var word
    setoff_peek var word
    setoff_peek = $6100

    peek_data0 var byte
    peek_data1 var byte
    peek_data2 var byte
    peek_data3 var byte
    peek_data4 var byte
    peek_data5 var byte
    peek_data6 var byte
    peek_data7 var byte
    peek_data8 var byte

    peek_d0 var byte
    peek_d1 var byte
    peek_d2 var byte
    peek_d3 var byte
    peek_d4 var byte
    peek_d5 var byte
    peek_d6 var byte
    peek_d7 var byte

    ic1 VAR BYTE 'data display in each matrix

    rowb var byte[8]
    ' row scan set up
    rowb[0] = %11111110
    rowb[1] = %11111101
    rowb[2] = %11111011
    rowb[3] = %11110111
    rowb[4] = %11101111
    rowb[5] = %11011111
    rowb[6] = %10111111
    rowb[7] = %01111111
    '--------------------------------------
    gosub peek_data_ini
    gosub peek_d_ini

    main:
    gosub search
    goto main
    '-------------------------------------
    peek_data_ini:

    peek_data0 = 0
    peek_data1 = 0
    peek_data2 = 0
    peek_data3 = 0
    peek_data4 = 0
    peek_data5 = 0
    peek_data6 = 0
    peek_data7 = 0
    peek_data8 = 0

    return
    '--------------------------------------

    peek_d_ini:

    peek_d0 = 0
    peek_d1 = 0
    peek_d2 = 0
    peek_d3 = 0
    peek_d4 = 0
    peek_d5 = 0
    peek_d6 = 0
    peek_d7 = 0

    return
    '-------------------------------------------
    search:
    for mm= 0 to 5 'store 6 data colum into array peek_data
    peek_ind = setoff_peek + mm ' read data from flash mem.
    peekcode peek_ind, peek_data8
    gosub shift 'shift data into 8 col
    gosub display 'display dat a on screen
    next
    return
    '--------------------------------------

    shift: 'full screen load 8 collums

    peek_data0 = peek_data1
    peek_data1 = peek_data2
    peek_data2 = peek_data3
    peek_data3 = peek_data4
    peek_data4 = peek_data5
    peek_data5 = peek_data6
    peek_data6 = peek_data7
    peek_data7 = peek_data8

    return

    '------------------------------------------

    copy: 'COPY DATA INTO TEMP. FILE

    peek_d0 = peek_data0
    peek_d1 = peek_data1
    peek_d2 = peek_data2
    peek_d3 = peek_data3
    peek_d4 = peek_data4
    peek_d5 = peek_data5
    peek_d6 = peek_data6
    peek_d7 = peek_data7

    return
    '-------------------------------------------

    load_file:

    asm ;'PROJECT DOWN
    RRCF _peek_d7,1
    RLCF _ic1,1
    RRCF _peek_d6,1
    RLCF _ic1,1
    RRCF _peek_d5,1
    RLCF _ic1,1
    RRCF _peek_d4,1
    RLCF _ic1,1
    RRCF _peek_d3,1
    RLCF _ic1,1
    RRCF _peek_d2,1
    RLCF _ic1,1
    RRCF _peek_d1,1
    RLCF _ic1,1
    RRCF _peek_d0,1
    RLCF _ic1,1
    endasm

    return
    '---------------------------------------
    display:
    call peek_d_ini
    for w = 0 to 15 '
    call copy
    for kk = 0 to 7 'display on the screen
    call load_file
    shiftout datb,clkb,0,[ic1,rowb[kk]]'
    stlb = 1: pauseus 5: stlb = 0
    pauseus 300
    datb = 0

    next
    next
    return

    '------------------------------------------
    end

    Pokecode @$6100, $00 ,$1C ,$22 ,$24 ,$3E, $00 'a 0
    Last edited by MINHLE; - 27th May 2013 at 18:09. Reason: add some comment

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,637


    Did you find this post helpful? Yes | No

    Default Re: 18f4550-problem output

    If this is your first time with an 18F4550, start simple. Blink the 8 LEDs manually first. I have PBP v2.60c, this example is a start (CONFIGs in PBP 3.0 is slightly different):

    http://www.picbasic.co.uk/forum/show...630#post116630

    Set your CONFIG within your code, we can't see what you set using your programmer.

    It's also a good idea to have your DEFINES at the top.

    Robert

  5. #5
    Join Date
    Apr 2008
    Posts
    85


    Did you find this post helpful? Yes | No

    Default Re: 18f4550-problem output

    thank for ur words.

    i did try bare pic18f4550, it runs well, and letters moving smothly. but when i add 595 shift register, the output is double and uncontrolable i.e. letter a, the result is 2 a,

    the thinh that i make some change in the .inc file. it does not solve the problem. st wrong in my program. i tried to narrow down the problem. then see that the issue comes from the scan subroutine (tried it by directing pic18f to control the matrix display (without 595) i.e clear scan port after each scanning). but in this program i cannot.

    note that the program runs well with pic16f877a and other pic16f's
    regards,

  6. #6
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default Re: 18f4550-problem output

    MINHLE

    From the 18F4550 data sheet:
    Digital input RC5 and RC4 are only available as port pins
    when the USB module is disabled (UCON<3> = 0).

    Unlike other PORTC pins, RC4 and RC5 do not have
    TRISC bits associated with them. As digital ports, they
    can only function as digital inputs.


    Norm

  7. #7
    Join Date
    Apr 2008
    Posts
    85


    Did you find this post helpful? Yes | No

    Default Re: 18f4550-problem output

    thanks Norm,
    i see it now, but in the program portC does not service. (PORTB.0,1,2 FOR DATA, LATCH AND CLK)
    after several tests, i found that problem comes from peekcode.
    direct input data to the 595, output is ok. but when i read data from flash memory by PEEKCODE, the problem appears.

    READING data from flash memory - BYTE
    WRITING data to flash memory - WORD

    I attempted to isolate lower byte of data (word) reading from flash memory, it does not solve the issue

    (note that changing osc configuration in the .inc does not effect the result)

    in the section 5.6 (PBP REERENCE MANUAL) concerning POKECODE

    "Note that POKECODE is a specialized command intended for use in
    circumstances under which standard methods won't serve. LOOKUP
    and LOOKUP2 are usually a better choice for constructing lookup
    tables in code space"
    REGARDS

Similar Threads

  1. ascii output problem
    By l_gaminde in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 4th March 2013, 06:16
  2. Math problem with PBP 2.6 and 18F4550, large numbers
    By wdmagic in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 3rd January 2013, 04:41
  3. Usart problem with 18F4550
    By maus in forum Serial
    Replies: 7
    Last Post: - 3rd November 2009, 03:54
  4. 18f4550 usb problem.. so im getting crazy..
    By MeSaKu in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 11th May 2009, 22:03
  5. 18F4550 XTAL Problem
    By Pesticida in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 22nd January 2008, 20:12

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