Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 01, 2024, 12:09:37 00:09


Login with username, password and session length


Pages: [1]
Print
Author Topic: have you info about SPI PROTOCOL?  (Read 7811 times)
0 Members and 1 Guest are viewing this topic.
hamid9543
Active Member
***
Offline Offline

Posts: 124

Thank You
-Given: 80
-Receive: 7


« on: May 11, 2007, 06:46:02 18:46 »

hi.  can you help me about spi protocol in pic basicpro  or  mikrobasic.
(please explain with example)
thanks
Logged
tavioman
Active Member
***
Offline Offline

Posts: 151

Thank You
-Given: 14
-Receive: 17



« Reply #1 on: May 11, 2007, 10:13:26 22:13 »

Would'nt you prefer C Language?
I can help you with examples in C.
Hardware SPI it's the best.
Logged

- Brain juice -
iphone
Active Member
***
Offline Offline

Posts: 168

Thank You
-Given: 115
-Receive: 10


« Reply #2 on: May 12, 2007, 02:00:44 14:00 »

Would'nt you prefer C Language?
I can help you with examples in C.
Hardware SPI it's the best.

tavioman,

Please go ahead for the C tutorial on SPI..  Grin

Thanks
Logged
hamid9543
Active Member
***
Offline Offline

Posts: 124

Thank You
-Given: 80
-Receive: 7


« Reply #3 on: May 12, 2007, 05:34:53 17:34 »

thanks for replay.but i need for pic basic or mikrobasic.
best regard
Logged
robban
Senior Member
****
Offline Offline

Posts: 265

Thank You
-Given: 34
-Receive: 38


Warrior


WWW
« Reply #4 on: May 14, 2007, 07:21:12 07:21 »

What kind of device do You wish to talk to via the SPI protocol?
In MikroBasic (found elsewhere in this forum) You have a number of SPI libraries. Go ahead and look in the help file there...
« Last Edit: May 14, 2007, 07:22:54 07:22 by robban » Logged

Code Warrior
hamid9543
Active Member
***
Offline Offline

Posts: 124

Thank You
-Given: 80
-Receive: 7


« Reply #5 on: May 14, 2007, 03:49:59 15:49 »

hi robban.
i want to conect RFM01(rf moudole) to pic16f877.
rfm01  conec with spi protocol
can you help me?
Logged
robban
Senior Member
****
Offline Offline

Posts: 265

Thank You
-Given: 34
-Receive: 38


Warrior


WWW
« Reply #6 on: May 15, 2007, 02:15:35 14:15 »

Here's come the link, including datasheet and programming example

http://rapidshare.com/files/31487929/RF01.rar.html
« Last Edit: May 15, 2007, 07:35:00 19:35 by robban » Logged

Code Warrior
hamid9543
Active Member
***
Offline Offline

Posts: 124

Thank You
-Given: 80
-Receive: 7


« Reply #7 on: May 16, 2007, 05:14:37 05:14 »

thanks robban.
it is a c compailer (i donot know )i need to mikribasic or picbaisc pro code.
can you help me or guide me for programing in mikrobasic or picbaisc pro?
thanks
Logged
zeus
Junior Member
**
Offline Offline

Posts: 39

Thank You
-Given: 46
-Receive: 35


« Reply #8 on: May 16, 2007, 05:36:17 05:36 »

You must use SPI in MODE1 and with 16 bit trasfer.

http://www.hoperf.com/pdf/RF01_code.pdf

also inc, you need to implement it to basic language.
I have used RF12. Problem with this RF modul is the tuning of our registers, and a well maked IT routin.

I don't used microbasic, but I think, that first U must init the port, then for write chip -select it, the spi_write first byte, then spi_write second byte then deselect chip.
Logged
mombasa
Newbie
*
Offline Offline

Posts: 8

Thank You
-Given: 8
-Receive: 15


« Reply #9 on: May 16, 2007, 09:42:54 09:42 »

For my rf module 2.4 Ghz. type  XTR-CYP-2.4 AUREL that has a SPI protocol, I used Pic Basic Pro Shiftin and Shiftout statements and it works fine. You can try.

mombasa
Lazio
Italy
Logged
hamid9543
Active Member
***
Offline Offline

Posts: 124

Thank You
-Given: 80
-Receive: 7


« Reply #10 on: May 16, 2007, 04:07:05 16:07 »


hi mombaso.can you explain what do you do?
thanks
best regard
Logged
hamed
Newbie
*
Offline Offline

Posts: 9

Thank You
-Given: 7
-Receive: 15


« Reply #11 on: January 12, 2008, 03:43:24 15:43 »

Hi
I'm using a pic 16F876A to send data via SPI protocol and rfm 01 and 02 with PIC Basic PRo , but can't work with this modules ,
please ...
 Smiley
« Last Edit: January 13, 2008, 06:08:46 06:08 by hamed » Logged
Cynetron
Newbie
*
Offline Offline

Posts: 25

Thank You
-Given: 25
-Receive: 31


« Reply #12 on: February 01, 2008, 11:12:31 23:12 »

you can use included spi or you can write a spi protocol as this address but if you need speed you should use included spi

http://www.picbasic.org/forum/showthread.php?t=5368
Logged
mcb58
Newbie
*
Offline Offline

Posts: 20

Thank You
-Given: 4
-Receive: 44


« Reply #13 on: February 09, 2008, 06:52:38 18:52 »

hi ;
Here is the sample picbasic code for using SPI eeproms

Write To the first 11 locations of a MICROCHIP 25LC640 SPI serial eeprom
' Then Read the 11 locations back and display them on a serial LCD
' The configuration is 8192 words x 8-bits

' To WRITE to the eeprom:-
' The 16-bit address is loaded into the variable "ADDR"
' The byte to write is loaded into the variable "E_BYTEOUT"
' And a call is made to the subroutine "EWRITE"

' To READ from the eeprom:-
' The 16-bit address is loaded into the variable "ADDR"
' And a call is made to the subroutine "EREAD"
' The byte at the specified address is returned in the variable "E_BYTEIN"

   Include "Modedefs.Bas"

' ** Setup the Crystal Frequency, in Mhz **

   Define    OSC      4      ' Set Xtal Frequency

' ** Set Debug Defines **

   Define   DEBUG_REG   PORTA      ' Debug PORT ?
   Define   DEBUG_BIT   0      ' *** Debug pin Bit ? ***
   Define   DEBUG_BAUD   9600      ' *** Debug Baud Rate ***
   Define   DEBUG_MODE   1      ' Set Serial Mode 1=Inverted
   Define   DEBUG_PACING   300      ' Delay 'in uS' between characters sent

' ** Define LCD Constants **

   I      Con   254      ' Control Byte
   Clr      Con   1      ' Clear the display
   Line1      Con   128      ' Point to beginning of line 1
   Line2      Con   192      ' Point to beginning of line 2
   Line3      Con   148      ' Point to beginning of line 3
   Line4      Con   212      ' Point to beginning of line 4

' ** Define the Pin assignments **
   CS         Var     PORTB.0         ' Chip select pin
   SCK        Var     PORTB.1         ' Clock pin
   SI         Var     PORTB.2         ' Data in pin
   SO         Var     PORTB.2         ' Data out pin

' ** Declare the Variables **
   Addr       var     Word            ' Memory address within the eeprom (0-511)
   E_Byteout   Var   Byte      ' Byte to be placed into the eeprom
   E_Bytein   Var   Byte      ' Byte read from the eeprom

' ** Define the eeprom's op-codes **
   WRSR      Con   1      ' Write to STATUS REGISTER op-code
   EWR      Con   2      ' WRITE op-code
   ERD      Con   3      ' READ op-code
   WRDI      Con   4      ' DISABLE WRITES op-code
   RDSR      Con   5      ' Read the STATUS REGISTER op-code
   EWEN      Con   6      ' ENABLE WRITES op-code

' ** THE MAIN PROGRAM STARTS HERE **

' Write the string, "HELLO WORLD" into the first 11 address's of the Eeprom

        For Addr=0 To 10                   ' Create a loop of 11
   LookUp Addr,["H","E","L","L","O"," ","W","O","R","L","D"],E_ByteOut' Build up the string
   GoSub EWrite            ' Write the byte to the Eeprom
        Next               ' Close the Loop

' Read the first 11 address's within the Eeprom and display them on the LCD

Again:  Debug I,Clr:Pause 30         ' Clear the LCD
   Pause 500            ' Pause for drama
   For Addr=0 To 10              ' Create a loop of 11
   GoSub ERead            ' Read the byte from the Eeprom
        Debug E_ByteIn           ' Display the characters read in from the eeprom
   Pause 300            ' Pause between characters being displayed
        Next               ' Close the loop
        GoTo Again            ' Do it forever

' Read a single byte from the Eeprom
' The address is held in the variable "ADDR"
' The byte read is returned in the variable "E_BYTEIN"
ERead:    Low CS                             ' Enable the eeprom
        Shiftout SI,SCK,msbfirst,[ERD,Addr.HighByte,Addr.LowByte]' Send READ COMMAND and address
        Shiftin SO,SCK,msbpre,[E_Bytein]      ' Read data
        High CS                             ' Disable the eeprom
        Return

' Write a single byte to the Eeprom
' The address is held in the variable "ADDR"
' The byte to be written is held in the variable "E_BYTEOUT"
EWrite: Low CS                               ' Enable the eeprom
        Shiftout SI,SCK,msbfirst,[EWEN]          ' Send WRITE ENABLE command
        High CS                             ' Disable the eeprom, to execute the command
        Low CS                             ' Re-enable the eeprom
        Shiftout SI,SCK,msbfirst,[EWR,Addr.HighByte,Addr.LowByte,E_Byteout]' Send address and data
        High CS                             ' Disable the eeprom
   Pause 5                         ' Allow the eeprom to allocate the byte
        Return
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC