Searching \ for '[PIC]: I hoped it didn't come to this' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'I hoped it didn't come to this'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: I hoped it didn't come to this'
2001\02\02@071551 by Peter May

flavicon
face
Well I have been trying to get a 16f84A to read data from a TLC548 and have
absolutely no experience and knowledge how to do it. I have
84a                     548
RB.0 connected to Data out (6)
RB.1                    I/O clock (7)
RB.2                    CS (5)

with the following code. (I don't mind being emarressed)


temp VAR WORD
cnt VAR WORD
cnt = 0
start:
cnt = cnt + 1
GoSub Serialin

SerOut PORTB.7,4,["here = ",#cnt,"temp = ",#temp,10,13] ' sends info to term
Pause 1000
GoTo start

Serialin:
Pause 500
Low PORTB.2
ShiftIn PORTB.0,PORTB.1,4,[temp]
Pause 500
High PORTB.2
Return

HELP PLEASE?

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\02\02@074745 by Terry Malthouse

flavicon
face
You defined temp as a WORD (16 bits), but your SHIFTIN statement only sends
out 8 bits (the default)!
Change it to:
ShiftIn PORTB.0,PORTB.1,4,[temp\16]


{Original Message removed}

2001\02\02@081453 by Peter May

flavicon
face
Thanks Terry. Can you see any other probs? I am amazed I am even that close.
I was also wondering if I had guessed the correct mode (4) for that
particular chip as in  MSB FIRST | Read data before clock (clock idles low)

This is all guess work so far. I have a long way to go and am doing bits and
pieces at a time

{Original Message removed}

2001\02\05@073414 by Terry Malthouse

flavicon
face
I myself am new to PICBASIC programming, so I may not be much help!

The only other problem that I can see is that you PAUSE 500 before returning
PORTB.2 high after SHIFTIN.
There is no need for this. In fact,it introduces the opportunity for 'noise'
spikes to enter the device and be seen as clocks.

Also remember that the MSB is available AS SOON AS PORTB.2 goes low, prior
to any clocks!

Regards
Terry

{Original Message removed}

2001\02\05@081820 by Terry Malthouse

flavicon
face
I have always assumed that you have previously set your TRIS register as
follows:

TRISB = %00000001

This sets PORTB.0 as an INPUT, and the remainder as OUTPUTS!
Regards
Terry

{Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...