This Forum is Dedicated For all The Object Oriented PIC Lovers .......... The concept behind OOPic is straight forward. Use preprogrammed multitasking Objects from a library of highly optimized Objects to do all the work of interacting with the hardware. Then write small scripts in Basic, C, or Java syntax styles to control the Objects. During operation, the Objects run continuously and simultaneously in the background while the scripts run in the foreground telling the objects what to do.

Saturday, June 7, 2008

Re: [oopic] Re: oopic oSPIL and a 74165

Richard
Here's my current code - I've got good signals for Load and ClkInhibit but absolutely 0 for Clk coming from the OOPIC and 0 info from the 74165 (probably because no CLK from OOPIC). Now I've loaded some oSPIL programs from the Examples directory and they all have good signals for the CLK from the OOPIC. Am I using the wrong syntax for reading the oSPIL object? What could be my stumbling block?
Regards
Dave W. 
 
'********************
'Declarations
Dim C165 As oSPIL
Dim Load As oDIO1
Dim Info As oByte
Dim Screen As oLCDSE
Dim ClkInhibit As oDIO1
'*******************
Sub main()
Call setup
Do
Screen.Clear
Screen.VString = "***********"
ooPIC.Delay=5000
 
Load.Value = 0      '/
ooPIC.Delay = 1000  '/     Latches Parallel Input lines
Load.Value = 1      '/
 
 
ClkInhibit.Value = 0     'remove ClkInhibit
ooPIC.Delay = 1000

Info.Data = C165.Value    'Read 74165
ClkInhibit = 1            'Restore ClkInhibit
 
Screen.Locate(1,0)
Screen.VString = Str$(Info.Data)  'Display Data
ooPIC.Delay=5000
 
Loop
 
End Sub'Main
'********************
Sub setup()
C165.IOLineC = 9      'Use as Clock input to '165 pin 2
C165.IOLineI = 10     'Use as Data line from '165 pin 9
C165.Rate = 0
C165.Width = cv8Bit
C165.Mode = 0

C165.Operate = cvOn
ClkInhibit.IOLine = 12     'Use as ClkInhibit to '165 pin 15
ClkInhibit.Direction = cvOutput
ClkInhibit.Value = 1
 
Load.IOLine = 14     'Use as Load to '165 pin 1
Load.Direction = cvOutput
Load.Value = 1
 
Screen.IOLine = 16
Screen.Clear
Screen.Locate(0,0)
 


--- On Fri, 6/6/08, rtstofer <rstofer@pacbell.net> wrote:

From: rtstofer <rstofer@pacbell.net>
Subject: [oopic] Re: oopic oSPIL and a 74165
To: oopic@yahoogroups.com
Date: Friday, June 6, 2008, 1:49 PM

Look at IOLineE. Does it idle high or low after you invert the sense.
In a normal SPI application the enable idles high and goes low to
select the device. That's fine, just what you want as the clock
inhibit needs to be low to shift data. But you inverted it...

Check with an LED, logic probe or scope.

Since you know you need the inhibit signal at 0, remove it from the
OOPic and ground it at the '165.

Similarly, you know you need Load high. I see where you defined the
Load pin but I don't see where you made it an output. Maybe you
should disconnect that from the OOPic and pull it high through a
resistor. You can momentarily ground the pin to load something using a
jumper. It won't matter if the signal isn't clean.

At this point, all you have connected is the serial input and the
clock. Check it out and then start putting it back together.

Richard

--- In oopic@yahoogroups. com, "bimityedye" <bimityedye@ ...> wrote:
>
> AAAAARRRRGGGG! !! I'm pulling my hair out!! I'm trying to access a
> 74hc165 using an oSPIL object, but to no avail. Nothing I do seems to
> work. Does anyone have the magic code to make this work? I can bit
> bang it well enough, but I should be able to do this with an oSPIL.
> Anybody? A mind is a terrible thing. Help! oopic III+ ver 6 compiler
> curent code -
>
> Dim C165 As oSPIL
> Dim Load As oDIO1
> Dim Data As oByte
> Dim Screen As oLCDSE
>
>
> '*********** ********
> Sub main()
>
> Call setup
>
> Screen.Clear
>
> Load = 0 'Pulse Load line to input parallel
> Load = 1 'data
> ooPIC.Delay = 5000
>
> Data.Value = C165.Value 'Read 74165
>
> Screen.VString = "*********** "
> ooPIC.Delay = 5000
> Screen.Locate( 1,0)
> Screen.Value = Data.Value
>
>
>
> End Sub'Main
> '*********** *********
> Sub setup()
>
> C165.IOLineC = 8 'Use as Clock input to '165 pin 2
> C165.IOLineI = 10 'Use as Data line from '165 pin 9
> C165.IOLineE = 12 'Use as Clock Inhibit to '165 pin 15
> C165.InvertE = cvTrue
> C165.Rate = 0
> C165.Width = 0
> C165.Mode = 0
> C165.Direction = 0
> C165.Operate = cvTrue
>
> Load.IOLine = 14 'Use as Load line to '165 pin 1
> Load.High
>
> Screen.IOLine = 16
> Screen.Clear
> Screen.Locate( 0,0)
>
>
> Dave W.
>


[Non-text portions of this message have been removed]


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:

http://groups.yahoo.com/group/oopic/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:

http://groups.yahoo.com/group/oopic/join

(Yahoo! ID required)

<*> To change settings via email:
mailto:oopic-digest@yahoogroups.com
mailto:oopic-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
oopic-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:

http://docs.yahoo.com/info/terms/

No comments: