|Most cognitive functions are based on computations that take place in the cerebral cortex, composed of a larger number of areas, each with a complex anatomical structure, with neurons of different types and in different layers interacting according to a precise scheme. The anatomical organization of cortical areas is similar, with some modulation according to its sensory, motor or associative function. Several areas have a columnar organization, but in all areas a similar vertical organization of cortical modules is repeated, suggesting that the same fundamental computation scheme is carried out. Despite the large amount of available data, this processing capability of the cortical module is still poorly understood. Two key technological advances to explore cortical computation have been ensemble electrophysiology, the use of multiple electrodes to record groups of neurons, and optogenetics. However, the optogenetic tools are still critically lacking in layer and cell-type specificity, and the recording techniques still do not attain the yields necessary to properly characterize the cortical microcircuit. To overcome these limitations, we propose a new probe that dramatically increases the density of electrodes providing an unprecedented view of currents in the extracellular medium. This will be complemented with an optical stimulator, capable of activating excitatory and inhibitory channelrhodopsins with a 100 µm resolution. We will take full advantage of the rich data that can be obtained with these new devices by producing new strategies for signal classification, to locate cells in cortical layers and assign them to a cell type based on the spatiotemporal fingerprint generated at each action potential. We will analyze cortical function at multiple scales in a number of contexts, from memory formation, to ongoing processing during decision making, and to sensorimotor integration for actions, advancing our understanding of cortical representations.