help for serial communication pic to pic


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818

    Default

    Hello jasm700,
    You want to look at the manual sect 4.17.7 it explains how to use the DIG command to get your digit.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  2. #2
    Join Date
    Dec 2008
    Posts
    12

    Default

    ok thanks all my friend i will try your suggetions

  3. #3
    Join Date
    Dec 2006
    Location
    WADSWORTH OHIO USA
    Posts
    37

    Default this works for me

    This is what i use to drive my 8 digit dual display

    Hope it helps.
    By adjusting f & f2 you can adjust the brightness...

    'REV 071408 * #disdrive9.01 DISPLAY LED DRIVER
    DEFINE OSC 20
    DEFINE SER2_BITS 8
    A VAR BYTE
    B VAR BYTE
    C VAR BYTE
    F VAR BYTE
    F2 VAR BYTE
    DCP VAR BYTE
    AMP VAR WORD
    TIME VAR WORD
    COUNTA VAR WORD
    COUNTB VAR WORD
    COUNTC VAR WORD
    SNO1 VAR WORD
    SNO2 VAR WORD

    FLOW7 VAR PORTA.0
    DAT7 VAR PORTA.1
    SPF10 VAR PORTA.2
    BURN VAR PORTA.3
    SPF02 VAR PORTA.4
    SPF03 VAR PORTA.5
    SEGMENT VAR PORTB
    DIGIT VAR PORTC

    TRISA = %11111111
    TRISB = %00000000
    TRISC = %00000000
    ADCON0 = %00000000
    ADCON1 = %00000111
    A = 0
    C = 0
    B = 0
    F = 100
    F2 = 3
    DCP = 0
    PAUSE 20
    TIME = 1234
    AMP = 5678

    EEPROM 0,[129,243,73,97,51,37,5,241,1,49,254,253,251,247,239 ,223,191,253]
    GOSUB BSEQ
    LOOP: ' AND NOW THE MAIN EVENT
    IF FLOW7 = 1 THEN
    SerIN2 PORTA.1,84,[TIME.highbyte,TIME.lowbyte,AMP.highbyte,AMP.lowbyt e,DCP]
    ENDIF
    IF DCP = 9 THEN
    GOSUB BSEQ
    ENDIF
    FOR C = 0 TO 4
    READ TIME DIG C,SEGMENT
    LOOKUP C,[$BF,$7F,$DF,$EF],DIGIT
    IF C = 4 THEN
    PORTB = %11111110
    IF DCP = 1 THEN DIGIT = $EF
    IF DCP = 2 THEN DIGIT = $DF
    IF DCP = 3 THEN DIGIT = $7F
    IF DCP = 4 THEN DIGIT = $BF
    ENDIF
    PAUSEUS f
    PORTB = $FF
    PORTC = $FF
    PAUSEUS F2
    NEXT C
    FOR B = 0 TO 4
    READ AMP DIG B,SEGMENT
    LOOKUP B,[$FE,$FD,$FB,$F7],DIGIT
    IF B = 4 THEN
    PORTB = %11111110
    IF DCP = 5 THEN DIGIT = $FE
    IF DCP = 6 THEN DIGIT = $FD
    IF DCP = 7 THEN DIGIT = $FB
    IF DCP = 8 THEN DIGIT = $F7
    ENDIF
    PAUSEUS f
    PORTB = $FF
    PORTC = $FF
    PAUSEUS F2
    NEXT B
    GOTO LOOP
    BSEQ: FOR A=0 TO 3
    FOR C = 0 TO 6
    READ C+11,SEGMENT
    LOOKUP A,[$EF,$DF,$7F,$BF],DIGIT
    PAUSEUS 1000
    PORTB = $FF
    PORTC = $FF
    PAUSE 10
    NEXT C
    PAUSE 2
    NEXT A
    FOR A=0 TO 3
    FOR B = 6 TO 0 STEP -1
    READ B+11,SEGMENT
    LOOKUP A,[$FE,$FD,$FB,$F7],DIGIT
    PAUSEUS 1000
    PORTB = $FF
    PORTC = $FF
    PAUSE 10
    NEXT B
    PAUSE 2
    NEXT A
    DCP = 1
    RETURN
    Thanks !
    SOMRU
    TWE/TFP/EE

Similar Threads

  1. 2 PIC, serial communication
    By lightgreen in forum Serial
    Replies: 6
    Last Post: - 21st November 2009, 15:20
  2. PIC to PIC "wired" serial one-way communication - SERIN2/SEROUT2
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 14th April 2008, 20:02
  3. PIC 2 PIC communication
    By Mario in forum Forum Requests
    Replies: 16
    Last Post: - 28th April 2006, 01:56
  4. Serial communication PIC to PIC help.
    By Rubicon in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th January 2005, 15:45
  5. Pic to Pic communication?
    By Rob Martin in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th April 2004, 19:41

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