A method for operating a dual-use semiconductor device , the dual-use semiconductor device comprising a substrate that includes a first region and a second region having a same type doping and a well having a different type of doping and separating the first region from the second region , the dual-use semiconductor device further comprising a switch device coupled between the first region and the second region , the method comprising: selectively configuring the dual-use semiconductor device to generate power by coupling, by the switch device , the first region to the second region to form a PN junction with the coupled regions and the well ; generating , with the PN junction, power based on light received by the PN junction; in response to generating the power, providing the power to a load coupled to respective power contacts of the dual-use semiconductor device , wherein a first of the power contacts is on the well and a second of the power contacts is on the first region or the second region ; selectively configuring the dual-use semiconductor device for data storage access by decoupling, by the switch device , the regions , such that the regions provide respective data storage access terminals; and accessing , via a control gate of a floating-gate structure of the dual-use semiconductor device and at least one of the respective data storage access terminals, the dual-use semiconductor device to write data to or read data from the dual-use semiconductor device , the floating-gate structure disposed over at least a portion of the well , the floating gate structure having a first layer of insulative material disposed over the at least a portion of the well , a floating-gate disposed over the first layer of insulative material and insulated from the well by the first layer of insulative material , a second layer of insulative material disposed over the floating-gate , and a control gate disposed over and insulated from the floating-gate by the second layer of insulative material . selectively configuring the dual-use semiconductor device to generate power by coupling, by the switch device , the first region to the second region to form a PN junction with the coupled regions and the well ; generating , with the PN junction, power based on light received by the PN junction; in response to generating the power, providing the power to a load coupled to respective power contacts of the dual-use semiconductor device , wherein a first of the power contacts is on the well and a second of the power contacts is on the first region or the second region ; selectively configuring the dual-use semiconductor device for data storage access by decoupling, by the switch device , the regions , such that the regions provide respective data storage access terminals; and accessing , via a control gate of a floating-gate structure of the dual-use semiconductor device and at least one of the respective data storage access terminals, the dual-use semiconductor device to write data to or read data from the dual-use semiconductor device , the floating-gate structure disposed over at least a portion of the well , the floating gate structure having a first layer of insulative material disposed over the at least a portion of the well , a floating-gate disposed over the first layer of insulative material and insulated from the well by the first layer of insulative material , a second layer of insulative material disposed over the floating-gate , and a control gate disposed over and insulated from the floating-gate by the second layer of insulative material . <EOS>