PDA

View Full Version : Touch Sensor



Pesticida
- 24th September 2007, 09:01
Hi,

I have found a very good Device B6TS-04LT,is a 4 Ch Sensor from OMRON.

http://docs-europe.electrocomponents.com/webdocs/095d/0900766b8095df92.pdf

I dont' know how I can put Photos on this Thread :-)

I Build the Sensor Device with a PIC 16F870 all Work Fine,my only Problem is that when I Read something for Example the Device ID (Work just in Setup Mode),sometime i Receive the Right ID sometime just FFFF and so on,I can not Read any other Value I try all Mode and Routines.

I use for Write this:

Include "modedefs.bas" ' Mode definitions for Serout

Define OSC 4

DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h
DEFINE HSER_SPBRG 25 ' 9600 Bauds
DEFINE HSER_CLROERR 1

..........
........


' PortB.4 is Data (Duplex)
' PortB.3 is Clock
'SCS is Chip select

'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''Write to Register'''''''''''''''''''''''''''''''''''''''''' '''''''''
Low PortB.2 ' SCS
pauseus 10
Shiftout PortB.4,PortB.3,5,[Command.highbyte,Dummy,DatenTX.highbyte,DatenTX.lo wbyte] 'Toggle
pauseus 10
High PortB.2
Sound Summer ,[124,10]
Pause 1000
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''Write to EEPROM'''''''''''''''''''''''''''''''''''''''''''' ''''''
Command.highbyte = %10111111 'Write EEPROM
Command.lowbyte = %00000000
DatenTX.highbyte = %01010011
DatenTX.lowbyte = %01010100
Dummy = $FF
Low PortB.2
pauseus 10
Shiftout PortB.4,PortB.3,5,[Command.highbyte,Dummy,DatenTX.highbyte,DatenTX.lo wbyte]
pauseus 10
High PortB.2
Sound Summer ,[124,10]
Pause 1000


This Work fine !

'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''Read ID'''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''
Command.highbyte = %00000000
Command.lowbyte = %00000000
DatenRX.highbyte = $00
DatenRX.lowbyte = $00
Dummy = $FF
Low PortB.2 'SCS
pauseus 10
Shiftin PortB.4,PortB.3,6,[Command.highbyte,Dummy,DatenRx.Highbyte,DatenRx.Lo wbyte]
pauseus 10
High PortB.2 ' SCS

This Code dont' Work all the Time,when I use any other Command I Receive just the ID und not the right Value what I need.

My second question :-) is why I need SCS what is SCS(Chip select).

I try Hours and Hours to find the way but no Result.

Thank you for any answer !

Regards Pesti.

Pesticida
- 24th September 2007, 20:03
Ok I now understand what Chip Select is !

But this dont Help me to find what the Problem is.

Regards Pesti.

Pesticida
- 26th September 2007, 16:44
I dont have try enough,I have now the solution .

Maybe some one have the same Problem !

For example:

ReadID:
DatenRX = 0
Low PortB.2 'Chip Select
Pauseus 1
Shiftout PortB.4,PortB.3,5,[Command.highbyte,Dummy] 'Send Command Byte
Pauseus 130 'Wait
Shiftin PortB.4,PortB.3,6,[DatenRX.highbyte,DatenRX.lowbyte] 'Receive Data from Slave
Pauseus 1
High PortB.2 'Chip Select
Pause 100
Hserout ["Command = ",DEC Command.lowbyte,",","Chip ID = ",HEX2 DatenRX.highbyte,HEX2 DatenRX.lowbyte,13]
Pause 2000
Command = 0
Goto Main

Regards Pesticida