hey guys
I really need help.
I have a project for school
I have to build 5 pic boards that controls 5 relay and have 5 switch which can be programmed to sw relay on and off. also i need to connect all 5 board and a pc using rs485. also u can control the relay from pc and programmed schedules for relay. i know it is a lot to ask but i will appriciate any input.
thanks. newboy.
I suggest you develop a RS485 to RS232 converter... so that the PC can talk to the PIC. If the pic has a RS485 card on it then you will only need one converter other wise 2 converters will be necesary.
A Visual Basic program can be created to output a character with which you can receive witht the pic and turn on the relays. Also have the PIC check the switches and send the data to the PC
I agree with Ivancho; I would build a converter using a PIC with an onboard USART to relay the RS232 signals to RS485. If I remember correctly the MAX485 chip has an enable signal for TX & RX which you can then turn on & off with the PIC.
Use a form in Excel or Access to define the switches. Use an ActiveX I/O control on the form to access the serial port. Take the switch status from your form and concatenate them into a char or byte which will be decoded by each PIC to determine if the relay has to be activated ie bit0 could be relay 1 & bit 2 relay 2 etc.
You can use an RS485 transceiver from maxim and others for all of the PIC-to-PIC connections. You only need RS232 from the PC to the bus. For that I would make (or buy) a simple RS232-RS485 converter.