/**
 * Java file created by JControl/IDE
 *
 * @author RSt
 * @date 04.11.04 15:49
 *
 */
import java.io.IOException;
import jcontrol.comm.RS232;
import jcontrol.io.Flash;

public class FlashRead {

    static Flash myFlash;
    static RS232 myRS232;

    public FlashRead() {
    	  try{
            //Initiate Flash object with context to bank 0
            myFlash = new Flash(0);
            //Initiate RS232 object for printing messages
            myRS232 = new RS232();//default = 19200 baud
        }catch(IOException e){
        }
    }

    public static void main(String[] args) {
        new FlashRead();
        String writeThis = "Welcome to JControl!!!";
        byte[] data = writeThis.getBytes();
        byte[] read = new byte[data.length];
        try{
        	  //write data to memory:
	          myFlash.write(data, 0, data.length, 0);
	          //read Flash content:
	          myFlash.read(read, 0, read.length, 0);
	          //write read data to serial port
	          myRS232.println(new String(read));
        }catch(IOException e){
		    }
		    for(;;);//Stops execution of this program.
    }
}
