A
aerona
- Jan 1, 1970
- 0
Hello guys,
I am having trouble with writing into an 8 bit register which has a RD,
WR and CS associated with it from a PIC18f452. The device I'm trying
to write to is called an Anybus-s device and I should mention that I am
a newbie to the world of micro-controllers.
I've tried 2 methods; 1st. I used the PSP device of the PIC, where the
8bits of portD is directly connected to the 8bits of my device. The WR,
RD and CS of the PIC connect to the RD, WR and CS of the device in the
order I've written. To read from the device I make WR and CS of the PIC
go low and read whts in PORTD (e.g. temp = PORTD).This works alright
however, when I want to write by making the RD and CS of the PIC go low
and PORTD = BINARYVALUE nothing happens.
2nd method. I don't use the PSP device but I still connect PORTD to the
8bit register and have RE0 connected to RD, RE1 to WR and RE2 connected
to CS of the device. When I want to read of the device I make PORTD
inputs and set RE0 and RE2 low (then high again), then temp = PORTD to
read. This also works fine, however when I want to write by making RE1
an RE2 low, PORTD outputs and PORTD = BINARYVALUE nothing happens
again.
The way I know the write isn't working is if the data was written
properly the device would send a response. When I write to the device I
keep the WR and CS low for approximately 40 micro seconds. I can't
seem to get the BINARYVALUE (which is e.g 11101100) to appear on the
PORTD pins for some reason.
If anyone has any suggestions I would be very grateful. For those who
might be interested the ANYbus device is used to interface a
micro-controller to the PLC so as to have something like a motor
controlled by the PLC.
I am having trouble with writing into an 8 bit register which has a RD,
WR and CS associated with it from a PIC18f452. The device I'm trying
to write to is called an Anybus-s device and I should mention that I am
a newbie to the world of micro-controllers.
I've tried 2 methods; 1st. I used the PSP device of the PIC, where the
8bits of portD is directly connected to the 8bits of my device. The WR,
RD and CS of the PIC connect to the RD, WR and CS of the device in the
order I've written. To read from the device I make WR and CS of the PIC
go low and read whts in PORTD (e.g. temp = PORTD).This works alright
however, when I want to write by making the RD and CS of the PIC go low
and PORTD = BINARYVALUE nothing happens.
2nd method. I don't use the PSP device but I still connect PORTD to the
8bit register and have RE0 connected to RD, RE1 to WR and RE2 connected
to CS of the device. When I want to read of the device I make PORTD
inputs and set RE0 and RE2 low (then high again), then temp = PORTD to
read. This also works fine, however when I want to write by making RE1
an RE2 low, PORTD outputs and PORTD = BINARYVALUE nothing happens
again.
The way I know the write isn't working is if the data was written
properly the device would send a response. When I write to the device I
keep the WR and CS low for approximately 40 micro seconds. I can't
seem to get the BINARYVALUE (which is e.g 11101100) to appear on the
PORTD pins for some reason.
If anyone has any suggestions I would be very grateful. For those who
might be interested the ANYbus device is used to interface a
micro-controller to the PLC so as to have something like a motor
controlled by the PLC.